Skip to content

build: switch gyb to Python3 #32127

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 2 commits into from
Jun 26, 2020

Conversation

compnerd
Copy link
Member

@compnerd compnerd commented Jun 1, 2020

Change the build system to invoke gyb with python3 instead of python2.

Replace this paragraph with a description of your changes and rationale. Provide links to external references/discussions if appropriate.

Resolves SR-NNNN.

@compnerd
Copy link
Member Author

compnerd commented Jun 1, 2020

@compnerd
Copy link
Member Author

compnerd commented Jun 1, 2020

@swift-ci please clean test

@compnerd
Copy link
Member Author

compnerd commented Jun 1, 2020

CC: @nathawes - you may also be interested in this since SwiftSyntax depends on gyb'ed output

@swift-ci
Copy link
Contributor

swift-ci commented Jun 1, 2020

Build failed
Swift Test Linux Platform
Git Sha - 05330c474d5a4cc79c1ce92783cb58e1f6401e76

@swift-ci
Copy link
Contributor

swift-ci commented Jun 2, 2020

Build failed
Swift Test OS X Platform
Git Sha - 05330c474d5a4cc79c1ce92783cb58e1f6401e76

@compnerd
Copy link
Member Author

compnerd commented Jun 2, 2020

@swift-ci please test macOS platform

@compnerd
Copy link
Member Author

compnerd commented Jun 2, 2020

@swift-ci please test Linux platform

@swift-ci
Copy link
Contributor

swift-ci commented Jun 2, 2020

Build failed
Swift Test Linux Platform
Git Sha - 05330c474d5a4cc79c1ce92783cb58e1f6401e76

@swift-ci
Copy link
Contributor

swift-ci commented Jun 2, 2020

Build failed
Swift Test OS X Platform
Git Sha - 05330c474d5a4cc79c1ce92783cb58e1f6401e76

@compnerd
Copy link
Member Author

compnerd commented Jun 2, 2020

@swift-ci please test Linux platform

@swift-ci
Copy link
Contributor

swift-ci commented Jun 2, 2020

Build failed
Swift Test Linux Platform
Git Sha - 05330c474d5a4cc79c1ce92783cb58e1f6401e76

@compnerd
Copy link
Member Author

compnerd commented Jun 2, 2020

@swift-ci please test Linux platform

@compnerd
Copy link
Member Author

compnerd commented Jun 2, 2020

@nathawes I can't seem to figure out why the tests on macOS are failing with this change. Happen to have any hints on why the tests are hitting this error:

The loaded '_InternalSwiftSyntaxParser' library is from a toolchain that is not compatible with this version of SwiftSyntax
Run lit-test-helper -help for more help.

@akyrtzi
Copy link
Contributor

akyrtzi commented Jun 2, 2020

swift-syntax repo also invokes gyb via its build-script to generate its swift code. def calculate_node_hash() is used to ensure swift-side parser and swift-syntax library are compatible.

If swift-side uses python3 and that function generates different hash than python2 from swift-syntax, there will be a mismatch.

@compnerd
Copy link
Member Author

compnerd commented Jun 2, 2020

@akyrtzi ah, thanks for that explanation. I'll try to get swift-syntax synced up then

@compnerd
Copy link
Member Author

@swift-ci please test macOS platform

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 05330c474d5a4cc79c1ce92783cb58e1f6401e76

@compnerd
Copy link
Member Author

@swift-ci please test macOS platform

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 05330c474d5a4cc79c1ce92783cb58e1f6401e76

@compnerd
Copy link
Member Author

@swift-ci please clean test

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 05330c474d5a4cc79c1ce92783cb58e1f6401e76

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 05330c474d5a4cc79c1ce92783cb58e1f6401e76

Change the build system to invoke gyb with python3 instead of python2.
@compnerd compnerd force-pushed the python-is-dead-long-live-python branch from 05330c4 to 102621a Compare June 19, 2020 18:04
@compnerd
Copy link
Member Author

@swift-ci please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 102621acb9160017be31d16c2b05c6c0e54c5a62

This adjusts the code to run identically under python 2 and python 3.
We would previously fail to digest the content in Python 3 as the `map`
is not equivalent.  This now results in the same encoding as Python 2.
@compnerd compnerd force-pushed the python-is-dead-long-live-python branch from 102621a to 4240a90 Compare June 19, 2020 20:40
@compnerd
Copy link
Member Author

@swift-ci Please Python lint

@compnerd
Copy link
Member Author

@swift-ci please test

@compnerd
Copy link
Member Author

@swift-ci please test Windows platform

@drexin
Copy link
Contributor

drexin commented Jun 19, 2020

/cc @shahmishal

@shahmishal shahmishal merged commit bbfcc62 into swiftlang:master Jun 26, 2020
@shahmishal
Copy link
Member

Thanks @compnerd!

@compnerd compnerd deleted the python-is-dead-long-live-python branch June 23, 2023 02:07
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.

5 participants