@@ -6,10 +6,11 @@ function Get-WhlFile {
66 [Parameter (Mandatory = $true )] [string ]$Destination ,
77 [Parameter (Mandatory = $false )] [string ]$ExtraIndexUrl = " "
88 )
9- $pipCommandArgs = " $Library == $Version "
9+ $pipCommandArgs = " "
1010 if ($ExtraIndexUrl ) {
11- $pipCommandArgs += " --extra-index-url $ExtraIndexUrl "
11+ $pipCommandArgs += " --extra-index-url $ExtraIndexUrl "
1212 }
13+ $pipCommandArgs += " $Library ==$Version "
1314
1415 # download the whl file
1516 Write-Host " pip download --quiet --only-binary :all: --dest $Destination --no-cache --no-deps $pipCommandArgs "
@@ -34,39 +35,39 @@ function Get-NamespacesFromWhlFile {
3435
3536 try {
3637
37- # Pulling the whl file generates output, make sure it's sent to null so
38- # it's not returned as part of this function.
39- $success = Get-WhlFile $Library $Version $destination $ExtraIndexUrl
40- if ($success ) {
41-
42- # Each library gets its own temporary directory. There should only be one whl
43- # file in the destination directory
44- $whlFile = Get-ChildItem - Path $destination - File - Filter " *.whl" | Select-Object - First 1
45- $unpackDir = Join-Path - Path $destination - ChildPath " $Library -$Version "
46- Expand-Archive - Path $whlFile - DestinationPath $unpackDir
47-
48- # Look for any directory that contains __init__.py with the following exceptions:
49- # 1. *.dist-info directories shouldn't be included in the results.
50- # 2. If any subdirectory starts with "_" it's internal and needs to be skipped
51- # 3. If there's a root level directory named "azure" with an __init__.py file then
52- # needs to be skipped. This doesn't happen with libraries released from the
53- # azure-sdk-for-python repository but there are older libraries that are in the
54- # docs directories which are/were released outside of the repository where this
55- # is true.
56- $rootLevelAzureDir = Join-Path - Path $unpackDir - ChildPath " azure"
57- $namespaceDirs = Get-ChildItem - Path $unpackDir - Recurse - Filter " __init__.py" |
58- Where-Object {$_.DirectoryName -notlike " *.dist-info" } |
59- Where-Object {$_.DirectoryName -notlike " *$ ( [IO.Path ]::DirectorySeparatorChar) _*" } |
60- Where-Object {$_.DirectoryName -ine $rootLevelAzureDir }
61- foreach ($namespaceDir in $namespaceDirs ) {
62- # strip off the root directy, everything left will be subDir1/subDir2 which needs
63- $partialDir = $namespaceDir.DirectoryName.Replace ($unpackDir + $ ([IO.Path ]::DirectorySeparatorChar), " " )
64- $namespaces += $partialDir.Replace ([IO.Path ]::DirectorySeparatorChar, " ." )
65- # Since only the primary namespace is being pulled, break out of the loop after
66- # the first one.
67- break
68- }
69- }
38+ # Pulling the whl file generates output, make sure it's sent to null so
39+ # it's not returned as part of this function.
40+ $success = Get-WhlFile $Library $Version $destination $ExtraIndexUrl
41+ if ($success ) {
42+
43+ # Each library gets its own temporary directory. There should only be one whl
44+ # file in the destination directory
45+ $whlFile = Get-ChildItem - Path $destination - File - Filter " *.whl" | Select-Object - First 1
46+ $unpackDir = Join-Path - Path $destination - ChildPath " $Library -$Version "
47+ Expand-Archive - Path $whlFile - DestinationPath $unpackDir
48+
49+ # Look for any directory that contains __init__.py with the following exceptions:
50+ # 1. *.dist-info directories shouldn't be included in the results.
51+ # 2. If any subdirectory starts with "_" it's internal and needs to be skipped
52+ # 3. If there's a root level directory named "azure" with an __init__.py file then
53+ # needs to be skipped. This doesn't happen with libraries released from the
54+ # azure-sdk-for-python repository but there are older libraries that are in the
55+ # docs directories which are/were released outside of the repository where this
56+ # is true.
57+ $rootLevelAzureDir = Join-Path - Path $unpackDir - ChildPath " azure"
58+ $namespaceDirs = Get-ChildItem - Path $unpackDir - Recurse - Filter " __init__.py" |
59+ Where-Object {$_.DirectoryName -notlike " *.dist-info" } |
60+ Where-Object {$_.DirectoryName -notlike " *$ ( [IO.Path ]::DirectorySeparatorChar) _*" } |
61+ Where-Object {$_.DirectoryName -ine $rootLevelAzureDir }
62+ foreach ($namespaceDir in $namespaceDirs ) {
63+ # strip off the root directy, everything left will be subDir1/subDir2 which needs
64+ $partialDir = $namespaceDir.DirectoryName.Replace ($unpackDir + $ ([IO.Path ]::DirectorySeparatorChar), " " )
65+ $namespaces += $partialDir.Replace ([IO.Path ]::DirectorySeparatorChar, " ." )
66+ # Since only the primary namespace is being pulled, break out of the loop after
67+ # the first one.
68+ break
69+ }
70+ }
7071 }
7172 finally {
7273 # Clean up the temp directory if it was created
0 commit comments