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

Gyp Python 3 fixes for Windows #29897

Closed
wants to merge 3 commits into from
Closed

Conversation

targos
Copy link
Member

@targos targos commented Oct 9, 2019

Commits:

tools: port Python 3 compat patches from node-gyp to gyp

Refs: https://github.com/nodejs/node-gyp/pull/1820
Refs: https://github.com/nodejs/node-gyp/pull/1843


build: always use strings for compiler version in gyp files

If GYP finds a string variable that can be converted to an integer,
it will do it when the variable is expanded. Use "0.0" instead of "0"
to force strings and be able to use comparison operations such as
`gas_version >= "2.26"` in Python 3.


tools: fix GYP MSVS solution generator for Python 3

/cc @nodejs/python

@targos targos requested a review from cclauss October 9, 2019 09:03
@nodejs-github-bot nodejs-github-bot added build Issues and PRs related to build files or the CI. openssl Issues and PRs related to the OpenSSL dependency. tools Issues and PRs related to the tools directory. labels Oct 9, 2019
@targos targos added python PRs and issues that require attention from people who are familiar with Python. and removed openssl Issues and PRs related to the OpenSSL dependency. labels Oct 9, 2019
@targos
Copy link
Member Author

targos commented Oct 9, 2019

Note: with this change and #29898, I'm able to build Node on Windows with VS 2019 and Python 3.7.

@nodejs-github-bot
Copy link
Collaborator

node.gyp Outdated Show resolved Hide resolved
@sam-github
Copy link
Contributor

Does tools: fix GYP MSVS solution generator for Python 3 needs to be ported back to node-gyp?

I'd RSLGTM it, but it failed in CI. I resumed in case the failures were ephemeral.

@nodejs-github-bot
Copy link
Collaborator

@richardlau
Copy link
Member

Use "0.0" instead of "0" to force strings and be able to use comparison operations such as
gas_version >= "2.26" in Python 3.

Is that a safe comparison? e.g. What if gas_version is "2.3"?

@targos
Copy link
Member Author

targos commented Oct 9, 2019

Use "0.0" instead of "0" to force strings and be able to use comparison operations such as
gas_version >= "2.26" in Python 3.

Is that a safe comparison? e.g. What if gas_version is "2.3"?

I have no idea. gas_version has always been string like that, unless it had the integer value 0.

tools/gyp/pylib/gyp/MSVSNew.py Outdated Show resolved Hide resolved
tools/gyp/pylib/gyp/MSVSNew.py Outdated Show resolved Hide resolved
tools/gyp/pylib/gyp/MSVSNew.py Outdated Show resolved Hide resolved
tools/gyp/pylib/gyp/generator/make.py Show resolved Hide resolved
tools/gyp/pylib/gyp/generator/make.py Show resolved Hide resolved
tools/gyp/pylib/gyp/generator/make.py Show resolved Hide resolved
If GYP finds a string variable that can be converted to an integer,
it will do it when the variable is expanded. Use "0.0" instead of "0"
to force strings and be able to use comparison operations such as
`gas_version >= "2.26"` in Python 3.
@nodejs-github-bot
Copy link
Collaborator

@sam-github
Copy link
Contributor

I'd be willing to rubber stamp this once @cclauss or someone more up to date on python weighs in.

Once question, @targos , is this CI-able? Do we have a windows CI machine with py3? I think that even if it did, we might currently "prefer" py2, so mere existence of py3 isn't enough yet.

I wonder, can Travis do a py3-only windows build?

@targos
Copy link
Member Author

targos commented Oct 11, 2019

is this CI-able? Do we have a windows CI machine with py3?

I don't know. I could try to add a github action to this PR that runs on Windows and remove it before landing.

  • py2 is tested in our CI and the results are OK
  • py3 was tested by me on my PC

@sam-github
Copy link
Contributor

If py3 works for you, that's good enough for now -- adding and removing an action to prove it isn't necessary from my perspective.

@cclauss
Copy link
Contributor

cclauss commented Oct 13, 2019

can Travis do a py3-only windows build?
Yes.

Copy link
Contributor

@cclauss cclauss left a comment

Choose a reason for hiding this comment

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

Nice! Thanks for this.

targos added a commit that referenced this pull request Oct 13, 2019
targos added a commit that referenced this pull request Oct 13, 2019
If GYP finds a string variable that can be converted to an integer,
it will do it when the variable is expanded. Use "0.0" instead of "0"
to force strings and be able to use comparison operations such as
`gas_version >= "2.26"` in Python 3.

PR-URL: #29897
Reviewed-By: Christian Clauss <[email protected]>
Reviewed-By: Sam Roberts <[email protected]>
targos added a commit that referenced this pull request Oct 13, 2019
PR-URL: #29897
Reviewed-By: Christian Clauss <[email protected]>
Reviewed-By: Sam Roberts <[email protected]>
@targos
Copy link
Member Author

targos commented Oct 13, 2019

Landed in 7de5a55...8728f86

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Issues and PRs related to build files or the CI. python PRs and issues that require attention from people who are familiar with Python. tools Issues and PRs related to the tools directory.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants