Skip to content

Make build-script-helper.py use python3 #956

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

marinaaisa
Copy link
Member

@marinaaisa marinaaisa commented Jul 28, 2025

Bug/issue #156708326, if applicable:

Summary

By aiming to update the Node version to 22.17.0 on Swift Docker for Swift DocC Render [1], we need to specify version 3 of python, otherwise it will try to use python 2 which it's not available in Node 22.

[1] swiftlang/swift-docker#487

Dependencies

This change unblocks this PR in Swift Docker: swiftlang/swift-docker#487

Testing

Steps:

  1. Make sure that SwiftCI works.

Checklist

Make sure you check off the following items. If they cannot be completed, provide a reason.

  • Added tests
  • Ran npm test, and it succeeded
  • Updated documentation if necessary

By aiming to update the Node version to 22.17.0 on Swift Docker for
Swift DocC Render [1], we need to specify the version 3 of python, otherwise
it will try to use python 2 which it's not available in Node 22.

[1] swiftlang/swift-docker#487
@marinaaisa marinaaisa requested a review from mportiz08 July 28, 2025 17:51
@marinaaisa
Copy link
Member Author

@swift-ci test

@marinaaisa
Copy link
Member Author

@swift-ci test

@marinaaisa
Copy link
Member Author

@swift-ci test

Removed from __future__ import print_function on line 16, which is not
needed in Python 3 since print() is already a function by default.
Updated the node version check to properly handle the fact that
subprocess.check_output() returns bytes in Python 3, not strings. Added
code to decode bytes to UTF-8 string and strip whitespace before
checking the version.
@marinaaisa
Copy link
Member Author

@swift-ci test

@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/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.

Does this script run in the CI tests for pull requests?

(Just making sure so we can ensure that whatever tool using this script actually does have python 3 installed and there are no syntax issues with this script when running with 3 vs 2.)

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.

2 participants