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 Python build scripts to use the print function #639

Merged
merged 1 commit into from
Dec 20, 2015
Merged

Update Python build scripts to use the print function #639

merged 1 commit into from
Dec 20, 2015

Conversation

alexwlchan
Copy link
Contributor

In Python 3, 'print' was changed from a statement to a function. Using
the future module allows scripts to use print function whether
running with Python 2.6+ or Python 3.x. This commit changes as many
instances of print as I could find to use the print function and the
future module.

This is part of ongoing work to get the Python scripts running under
both Python 2 and 3; see PR #90.

@modocache
Copy link
Contributor

Thanks for continuing to push this through!! 👍

How does this pull request relate to #90? You mentioned you'd split up #90, but this pull request is even larger than that one.

@alexwlchan
Copy link
Contributor Author

@modocache Two differences:

  • The original PR was just looking for files that ended in *.py, which turns out not to be a good indicator of whether a file uses Python. I missed a lot of stuff. Now I’m just grepping for anything that looks like a print statement.
  • The original PR was an attempt to get a clean run of all scripts against Python 3, which involves a substantial number of changes. This is a single, specific change that is hopefully easier to review.

@modocache
Copy link
Contributor

Ah, gotcha. Well, all the changes look good to me!! Looks like you have a merge conflict, though.

In Python 3, 'print' was changed from a statement to a function.  Using
the __future__ module allows scripts to use print function whether
running with Python 2.6+ or Python 3.x.  This commit changes as many
instances of print as I could find to use the print function and the
__future__ module.
@alexwlchan
Copy link
Contributor Author

Rebased; merged conflicts fixed.

@gribozavr
Copy link
Contributor

LGTM, tested on Ubuntu 14.04 and OS X.

gribozavr added a commit that referenced this pull request Dec 20, 2015
Update Python build scripts to use the print function
@gribozavr gribozavr merged commit a600836 into swiftlang:master Dec 20, 2015
@practicalswift
Copy link
Contributor

@alexwlchan This is what I've used to find all Python files in the repo:

(git grep '#.*python'; find . -name '*.py' -type f) | grep -v .gitignore | sed 's|^./||g' | cut -f1 -d: | sort | uniq

Nice work cleaning up BTW! :-)

kateinoigakukun pushed a commit to kateinoigakukun/swift that referenced this pull request Apr 16, 2020
freak4pc pushed a commit to freak4pc/swift that referenced this pull request Sep 28, 2022
…ccache

Support using sccache when building the Swift toolchain for a stress tester run
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.

4 participants