Skip to content

Update build-script-helper.py to Python 3 #151

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

Merged
merged 1 commit into from
Jun 1, 2022

Conversation

ahoppen
Copy link
Member

@ahoppen ahoppen commented May 27, 2022

When running locally, it looks like we just need to change the shebang.

#150

@ahoppen
Copy link
Member Author

ahoppen commented May 27, 2022

@swift-ci Please test

#!/usr/bin/env python

from __future__ import print_function
#!/usr/bin/env python3
Copy link
Contributor

Choose a reason for hiding this comment

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

Depending on the python 3 version I'm not sure just this change is enough. It's fine for valid args but running with no args ends up with a stacktrace instead of error - I believe this is caused by the behavior of add_subparsers. It should now take required=True in Python >= 3.7.

@@ -93,7 +91,7 @@ def add_common_args(parser):
parser.add_argument('--sanitize-all', action='store_true', help='build using every available sanitizer in sub-directories of build path')
parser.add_argument('--verbose', '-v', action='store_true', help='enable verbose output')

subparsers = parser.add_subparsers(title='subcommands', dest='action', metavar='action')
subparsers = parser.add_subparsers(title='subcommands', dest='action', required=True, metavar='action')
Copy link
Contributor

Choose a reason for hiding this comment

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

Does PR CI run on Ubuntu 18.04? 3.7 was released in 2018, so wouldn't surprise me if it didn't have it.

Copy link
Member Author

Choose a reason for hiding this comment

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

I just checked, they run Python 3.6.9 😬 I guarded the required=True option behind a Python version check.

@ahoppen ahoppen merged commit c436a3f into swiftlang:main Jun 1, 2022
@ahoppen ahoppen deleted the pr/python3 branch June 1, 2022 07:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants