GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — build: allow build with system python 3 by forivall · Pull Request #16058 · nodejs/node

Conversation

@forivall

@forivall forivall commented Oct 7, 2017

Copy link
Copy Markdown
Contributor

When the system python is python 3, configure now creates a directory
with a symlink called 'python' to python2, uses it when it calls
run_gyp, and puts it in config.mk so that it propagates to everything
that make launches

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines
Affected core subsystem(s)

build

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Trott, MylesBorins, and keimlink reacted with thumbs up emoji Trott, MylesBorins, bengl, gibfahn, AndreasMadsen, and apapirovski reacted with hooray emoji Trott and MylesBorins reacted with heart emoji
All reactions
  • 👍 3 reactions
  • 🎉 6 reactions
  • ❤️ 2 reactions
@nodejs-github-bot nodejs-github-bot added the build Issues and PRs related to Node.js builds or CI infrastructure. label Oct 7, 2017
@forivall

forivall commented Oct 7, 2017

Copy link
Copy Markdown
Contributor Author

Waiting for CI to determine if changes are needed for windows.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@gibfahn

gibfahn commented Oct 7, 2017 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

CI: https://ci.nodejs.org/job/node-test-commit/12832/

EDIT: CI was green.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

gibfahn
gibfahn approved these changes Oct 7, 2017
View reviewed changes
@gibfahn

gibfahn commented Oct 7, 2017

Copy link
Copy Markdown
Member

cc/ @nodejs/build @nodejs/python

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Trott Trott added the code-and-learn Issues related to the Code-and-Learn events and PRs submitted during the events. label Oct 7, 2017
benjamingr
benjamingr approved these changes Oct 7, 2017
View reviewed changes
bnoordhuis
bnoordhuis reviewed Oct 7, 2017
View reviewed changes
Comment thread configure
raise e
os.symlink(sys.executable, python_link)

os.environ['PATH'] = bin_override + ':' + os.environ['PATH']

@bnoordhuis bnoordhuis Oct 7, 2017

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

This is a no-op as far as I can tell, it doesn't affect the parent shell.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@forivall forivall Oct 7, 2017

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

gyp does a "python -c" call, and this is required for it to work. Will add comment

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

gibfahn reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
Comment thread configure Outdated
bin_override = None

def setup_bin_overrides():
global bin_override

@bnoordhuis bnoordhuis Oct 7, 2017

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

What is the reason you use a global instead of returning a value?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@forivall forivall Oct 7, 2017

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

It mirrored what other stages were doing, with setting values in "o". Returning makes more sense, will change

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread configure Outdated
bin_override = os.path.abspath('out/tools/bin')
try:
os.makedirs(bin_override)
except os.error as e:

@bnoordhuis bnoordhuis Oct 7, 2017

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

For consistency with the rest of the file, can you use OSError in this function?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

forivall reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
Comment thread configure Outdated

setup_bin_overrides()
if bin_override:
config = 'export PATH:=' + bin_override + ':${PATH}\n' + config

@bnoordhuis bnoordhuis Oct 7, 2017

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Out of curiosity, why ${PATH} and not $(PATH)?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@forivall forivall Oct 7, 2017

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

It's what was on the stack overflow answer. 😝 Will change if I can

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
addaleax
addaleax approved these changes Oct 7, 2017
View reviewed changes
@forivall
build: allow build with system python 3
741a772
When the system python is python 3, configure now creates a directory
with a symlink called 'python' to python2, uses it when it calls
run_gyp, and puts it in config.mk so that it propagates to everything
that make launches
@forivall
forivall force-pushed the python2-bin-stub branch from 73bcd94 to 741a772 Compare October 7, 2017 18:43
@forivall

forivall commented Oct 7, 2017

Copy link
Copy Markdown
Contributor Author

Updated for reviews. Diff @ forivall@528a99d

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

addaleax
addaleax approved these changes Oct 7, 2017
View reviewed changes
bengl
bengl approved these changes Oct 7, 2017
View reviewed changes
@forivall forivall mentioned this pull request Oct 7, 2017
build: allow build with system python 3 ayojs/ayo#97
Closed
2 tasks done
bnoordhuis
bnoordhuis approved these changes Oct 8, 2017
View reviewed changes

@bnoordhuis bnoordhuis left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

LGTM. CI: https://ci.nodejs.org/job/node-test-pull-request/10497/

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@gibfahn

gibfahn commented Oct 8, 2017

Copy link
Copy Markdown
Member

Landed in 2b5b423.

Thanks for fixing this @forivall , and congrats on becoming a Contributor 🎉 .

addaleax, Trott, forivall, and apapirovski reacted with hooray emoji
All reactions
  • 🎉 4 reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@gibfahn gibfahn closed this Oct 8, 2017
gibfahn pushed a commit that referenced this pull request Oct 8, 2017
@forivall @gibfahn
build: allow build with system python 3
2b5b423
When the system python is python 3, configure now creates a directory
with a symlink called 'python' to python2, uses it when it calls
run_gyp, and puts it in config.mk so that it propagates to everything
that make launches

PR-URL: #16058
Reviewed-By: Gibson Fahnestock <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Bryan English <[email protected]>
Reviewed-By: Ben Noordhuis <[email protected]>
MylesBorins pushed a commit that referenced this pull request Oct 11, 2017
@forivall @MylesBorins
build: allow build with system python 3
67cef9b
When the system python is python 3, configure now creates a directory
with a symlink called 'python' to python2, uses it when it calls
run_gyp, and puts it in config.mk so that it propagates to everything
that make launches

PR-URL: #16058
Reviewed-By: Gibson Fahnestock <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Bryan English <[email protected]>
Reviewed-By: Ben Noordhuis <[email protected]>
@MylesBorins MylesBorins mentioned this pull request Oct 11, 2017
v8.7.0 proposal #15762
Merged
addaleax pushed a commit to addaleax/ayo that referenced this pull request Oct 12, 2017
@forivall @addaleax
build: allow build with system python 3
af8bd5f
When the system python is python 3, configure now creates a directory
with a symlink called 'python' to python2, uses it when it calls
run_gyp, and puts it in config.mk so that it propagates to everything
that make launches

PR-URL: nodejs/node#16058
Reviewed-By: Gibson Fahnestock <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Bryan English <[email protected]>
Reviewed-By: Ben Noordhuis <[email protected]>
@hefangshi

hefangshi commented Oct 12, 2017

Copy link
Copy Markdown
Contributor

This change made Node.js build need install distutils packages which is a dependency change, python3 won't break old build environment but distutils dependency will, maybe we can implement a less dependent method to find default python binary?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bnoordhuis

bnoordhuis commented Oct 12, 2017

Copy link
Copy Markdown
Member

@hefangshi distutils is part of python's stdlib. Are you thinking of setuptools?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@gibfahn

gibfahn commented Oct 12, 2017

Copy link
Copy Markdown
Member

Looks like distutils is included by default from Python 2.6 onwards, but maybe not in some distributions (looking at https://stackoverflow.com/questions/3810521/how-to-install-python-distutils).

@hefangshi what platform and version of Python are you on?

Also this commit doesn't add the distutils dependency, it was there before (from the diff 2b5b423):

image

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@gibfahn gibfahn added the lts-watch-v6.x label Oct 16, 2017
@gibfahn

gibfahn commented Oct 16, 2017

Copy link
Copy Markdown
Member

+1 on landing on a future v6.x release, and it should land with #16241 (assuming that lands).

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@forivall

forivall commented Oct 16, 2017 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor Author

Yeah, i had assumed the distutils would be fine since it would be loaded if it was python 3 or <= 2.5. there's probably an alternative version of 'which' that doesn't depend on distutils, since that's the only thing it's used for.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@gireeshpunathil gireeshpunathil mentioned this pull request Oct 17, 2017
build: use bin path override if no python is found in PATH #16241
Closed
2 tasks done
@MylesBorins

MylesBorins commented Oct 17, 2017

Copy link
Copy Markdown
Contributor

waiting for #16241 before landing this on v6.x. Please LMK if we don't need to wait

gibfahn reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@gibfahn gibfahn mentioned this pull request Oct 23, 2017
configure fails on linux for distributions using python 3 as default #9512
Closed
@MylesBorins MylesBorins added land-on-v6.x and removed lts-watch-v6.x labels Nov 14, 2017
MylesBorins pushed a commit that referenced this pull request Nov 14, 2017
@forivall @MylesBorins
build: allow build with system python 3
49908b1
When the system python is python 3, configure now creates a directory
with a symlink called 'python' to python2, uses it when it calls
run_gyp, and puts it in config.mk so that it propagates to everything
that make launches

PR-URL: #16058
Reviewed-By: Gibson Fahnestock <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Bryan English <[email protected]>
Reviewed-By: Ben Noordhuis <[email protected]>
@MylesBorins MylesBorins mentioned this pull request Nov 21, 2017
v6.12.1 proposal #17180
Merged
MylesBorins pushed a commit that referenced this pull request Nov 21, 2017
@forivall @MylesBorins
build: allow build with system python 3
5248215
When the system python is python 3, configure now creates a directory
with a symlink called 'python' to python2, uses it when it calls
run_gyp, and puts it in config.mk so that it propagates to everything
that make launches

PR-URL: #16058
Reviewed-By: Gibson Fahnestock <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Bryan English <[email protected]>
Reviewed-By: Ben Noordhuis <[email protected]>
MylesBorins pushed a commit that referenced this pull request Nov 28, 2017
@forivall @MylesBorins
build: allow build with system python 3
d4b3b63
When the system python is python 3, configure now creates a directory
with a symlink called 'python' to python2, uses it when it calls
run_gyp, and puts it in config.mk so that it propagates to everything
that make launches

PR-URL: #16058
Reviewed-By: Gibson Fahnestock <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Bryan English <[email protected]>
Reviewed-By: Ben Noordhuis <[email protected]>
MylesBorins added a commit that referenced this pull request Nov 28, 2017
@MylesBorins
2017-12-05, Version 6.12.1 'Boron' (LTS)
4a99c2b
Notable Changes:

* build:
  - fix npm install with --shared (Ben Noordhuis)
    #16438
* build:
  - building with python 3 is now supported (Emily Marigold Klassen)
    #16058
* src:
  - v8 options can be specified with either '\_' or '-' in NODE_OPTIONS
    (Sam Roberts) #14093

PR-URL: #17180
MylesBorins added a commit that referenced this pull request Dec 5, 2017
@MylesBorins
2017-12-05, Version 6.12.1 'Boron' (LTS)
3549d9c
Notable Changes:

* build:
  - fix npm install with --shared (Ben Noordhuis)
    #16438
* build:
  - building with python 3 is now supported (Emily Marigold Klassen)
    #16058
* src:
  - v8 options can be specified with either '\_' or '-' in NODE_OPTIONS
    (Sam Roberts) #14093

PR-URL: #17180
@corwin-of-amber corwin-of-amber mentioned this pull request Dec 4, 2018
passing python2.7 path doesnot have effect nwjs/nw-gyp#122
Open
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@bengl bengl bengl approved these changes
@bnoordhuis bnoordhuis bnoordhuis approved these changes
@addaleax addaleax addaleax approved these changes
@benjamingr benjamingr benjamingr approved these changes
+1 more reviewer
@gibfahn gibfahn gibfahn approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

build Issues and PRs related to Node.js builds or CI infrastructure. code-and-learn Issues related to the Code-and-Learn events and PRs submitted during the events.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

10 participants

@forivall @gibfahn @hefangshi @bnoordhuis @MylesBorins @bengl @addaleax @benjamingr @Trott @nodejs-github-bot
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.