Skip to content

Commit

Permalink
make get_package_properties.py a script with arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
chidozieononiwu committed Mar 3, 2021
1 parent b0d789a commit 1d72f14
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
13 changes: 8 additions & 5 deletions eng/scripts/Language-Settings.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ function Get-AllPackageInfoFromRepo ($serviceDirectoryName)
try
{
pip install packaging==20.4 -q -I
$allSetupProps = (python -c "import sys; import os; sys.path.append(os.path.join('eng', 'scripts')); \
import get_package_properties; get_package_properties.get_all_package_properties('$searchPath')")
$allSetupProps = python "eng\scripts\get_package_properties.py" -s $searchPath
}
catch
{
Expand All @@ -30,11 +29,15 @@ function Get-AllPackageInfoFromRepo ($serviceDirectoryName)

foreach ($line in $allSetupProps)
{
$setupInfo = $line -Split ","
$packageName = $setupInfo[0].Trim("(' ")
$setupInfo = ($line -Split ",").Trim("()")
if ($setupInfo.Count < 3)
{
continue
}
$packageName = $setupInfo[0].Trim("' ")
$packageVersion = $setupInfo[1].Trim("' ")
$isNewSdk = $setupInfo[2].Trim()
$setupPyDir = $setupInfo[3].Trim(")' ")
$setupPyDir = $setupInfo[3].Trim("' ")
$pkgDirectoryPath = Resolve-Path (Join-Path -Path $RepoRoot $setupPyDir)
$serviceDirectoryName = Split-Path (Split-Path -Path $pkgDirectoryPath -Parent) -Leaf
if ($packageName -match "mgmt")
Expand Down
9 changes: 7 additions & 2 deletions eng/scripts/get_package_properties.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
import argparse
import sys
import glob
import os

sys.path.append(os.path.join('scripts', 'devops_tasks'))
from common_tasks import get_package_properties

def get_all_package_properties(search_path):
for p in glob.glob(search_path, recursive=True):
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Get package version details from the repo')
parser.add_argument('-s', '--search_path', required=True, help='The scope of the search')
args = parser.parse_args()

for p in glob.glob(args.search_path, recursive=True):
if os.path.basename(os.path.dirname(p)) != 'azure-mgmt' and os.path.basename(os.path.dirname(p)) != 'azure' and os.path.basename(os.path.dirname(p)) != 'azure-storage':
print(get_package_properties(os.path.dirname(p)))

0 comments on commit 1d72f14

Please sign in to comment.