Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update get_package_properties.py logic for python 2.7 #17144

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions eng/scripts/Language-Settings.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ $BlobStorageUrl = "https://azuresdkdocs.blob.core.windows.net/%24web?restype=con
function Get-AllPackageInfoFromRepo ($serviceDirectory)
{
$allPackageProps = @()
$searchPath = Join-Path sdk * * setup.py
$searchPath = "sdk"
if ($serviceDirectory)
{
$searchPath = Join-Path sdk ${serviceDirectory} * setup.py
$searchPath = Join-Path sdk ${serviceDirectory}
}

$allPkgPropLines = $null
Expand Down
8 changes: 5 additions & 3 deletions eng/scripts/get_package_properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
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):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about this doesn't work for python 2.7?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also why do we care about 2.7 support in this script? Is there a case we are running in that context?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

glob.glob( ,recursive=True) does not work in python 2.7. This causes it to fail when it is run on some test pipelines that are using python 2.7

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)))
for root, dirs, files in os.walk(args.search_path):
for filename in files:
if os.path.basename(filename) == "setup.py":
if os.path.basename(root) != 'azure-mgmt' and os.path.basename(root) != 'azure' and os.path.basename(root) != 'azure-storage' and os.path.basename(root) != 'tests':
print(get_package_properties(root))