Skip to content

fix: do not require python2 to build node from source - #429

Open
r3wretrhy wants to merge 1 commit into
ekalinin:masterfrom
r3wretrhy:fix/source-build-no-python2
Open

r3wretrhy wants to merge 1 commit into
ekalinin:masterfrom
r3wretrhy:fix/source-build-no-python2

Conversation

@r3wretrhy

Copy link
Copy Markdown
Contributor

Fixes #419.

build_node_from_src() still carries the shim from when node.js needed Python 2 to build. On Python 3 it looks up python2, raises OSError if there isn't one, and otherwise prepends a tmpbin dir whose python points at python2. Since nodeenv only runs on Python 3 now, nodeenv --source fails on any machine without python2, which is most of them.

node.js has built with Python 3 for a long time, and its ./configure picks an interpreter on its own (python3.x, then python3, then python). So the shim isn't needed anymore, and when it does find a python2 it can actually hurt, because current node rejects Python 2.

This removes the shim and runs configure / make / make install with the inherited environment. The src_dir parameter stays so the signature doesn't change.

Tests:

  • Added test_build_node_from_src_does_not_need_python2. It mocks callit with no python2 on PATH and checks that configure/make/make install run in the node source dir with no PATH override and no tmpbin dir. It fails on master with the OSError from the issue and passes with this change.
  • pytest -m 'not integration' tests: 354 passed, 46 skipped.
  • flake8 --extend-ignore=E127 nodeenv.py tests setup.py is clean.

build_node_from_src() raised OSError whenever nodeenv ran on Python 3
and no python2 command was on PATH, and otherwise prepended a tmpbin
dir that points `python` at python2. node.js has built with Python 3
for years and its ./configure picks python3.x on its own, so drop the
shim and let the build use the inherited environment.

Fixes ekalinin#419.

This branch has not been deployed

No deployments
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.

--source fails without python2 on Python 3

1 participant