@@ -6,27 +6,43 @@ $MetadataUri = "https://raw.githubusercontent.com/Azure/azure-sdk/master/_data/r
66$BlobStorageUrl = " https://azuresdkdocs.blob.core.windows.net/%24web?restype=container&comp=list&prefix=python%2F&delimiter=%2F"
77
88function Get-python-PackageInfoFromRepo ($pkgPath , $serviceDirectory , $pkgName )
9- {
10- pip install packaging== 20.4 - q - I
11- $pkgName = $pkgName.Replace (' _' , ' -' )
9+ {
10+ $packageName = $pkgName.Replace (' _' , ' -' )
11+ $pkgDirName = Split-Path $pkgPath - Leaf
12+ if ($pkgDirName -ne $packageName )
13+ {
14+ # Common code triggers this function against each directory but we can skip if it doesn't match package name
15+ return $null
16+ }
17+
1218 if (Test-Path (Join-Path $pkgPath " setup.py" ))
1319 {
1420 $setupLocation = $pkgPath.Replace (' \' , ' /' )
1521 pushd $RepoRoot
16- $setupProps = (python - c " import sys; import os; sys.path.append(os.path.join('scripts', 'devops_tasks')); from common_tasks import get_package_properties; obj=get_package_properties('$setupLocation '); print('{0},{1},{2}'.format(obj[0], obj[1], obj[2]));" ) -split " ,"
22+ $setupProps = $null
23+ try {
24+ pip install packaging== 20.4 - q - I
25+ $setupProps = (python - c " import sys; import os; sys.path.append(os.path.join('scripts', 'devops_tasks')); from common_tasks import get_package_properties; obj=get_package_properties('$setupLocation '); print('{0},{1},{2}'.format(obj[0], obj[1], obj[2]));" ) -split " ,"
26+ }
27+ catch
28+ {
29+ # This is soft error and failure is expected for python metapackages
30+ Write-Host " Failed to parse package properties for " $packageName
31+ }
1732 popd
18- if (($setupProps -ne $null ) -and ($setupProps [0 ] -eq $pkgName ))
33+ if (($setupProps -ne $null ) -and ($setupProps [0 ] -eq $packageName ))
1934 {
2035 $pkgProp = [PackageProps ]::new($setupProps [0 ], $setupProps [1 ], $pkgPath , $serviceDirectory )
21- if ($pkgName -match " mgmt" )
36+ if ($packageName -match " mgmt" )
2237 {
2338 $pkgProp.SdkType = " mgmt"
2439 }
2540 else
2641 {
2742 $pkgProp.SdkType = " client"
2843 }
29- $pkgProp.IsNewSdk = $setupProps [3 ]
44+ $pkgProp.IsNewSdk = $setupProps [2 ]
45+ $pkgProp.ArtifactName = $pkgName
3046 return $pkgProp
3147 }
3248 }
0 commit comments