Skip to content

fix: preserve Python command identity in legacy source builds - #437

Open
jihtsan wants to merge 2 commits into
ekalinin:masterfrom
jihtsan:codex/435-source-python-launcher
Open

jihtsan wants to merge 2 commits into
ekalinin:masterfrom
jihtsan:codex/435-source-python-launcher

Conversation

@jihtsan

@jihtsan jihtsan commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Legacy source builds fail when Python 2 is installed only as python2.7, when a previous build leaves a stale/dangling tmpbin/python link, or when a pyenv-style shim dispatches using its command name. Relative PATH entries also produce broken links after changing into the Node source directory.

Find python2.7 when python2 is absent. For Node before 8.8, write an executable launcher that invokes the selected command by its original absolute, shell-quoted path and forwards arguments. Remove previous symlinks without changing their targets, and refresh the launcher on retries. Preserve #429's version boundaries: 8.8–12.x get no PATH override; 13+ do not require Python 2.

Validation on macOS:

  • Six subprocess regression cases fail on unchanged base 0c67226 and pass after this change. They cover the five reported cases plus retrying with a different interpreter, using fake configure/make/Python commands without downloading Node.
  • CPython 3.13: targeted build tests 17 passed. Full non-integration suite: 403 passed, 10 skipped, 2 xfailed, 1 failed. The failure is test_mirror_credentials_stay_out_of_error_messages receiving HTTP 503, reproduced on unchanged base.
  • CPython 3.10.21: non-integration suite excluding that baseline network failure: 402 passed, 11 skipped, 2 xfailed.
  • python -m flake8 --extend-ignore=E127 nodeenv.py tests setup.py and git diff --check passed.

Actual old Node compilation with a real Python 2 installation, Linux/Windows execution, and the remaining Python CI matrix were not run locally. Prepared and reviewed with Codex assistance.

Closes #435.

CI follow-up: Windows unit tests exposed a hard-coded POSIX path in the launcher assertion. The follow-up uses a native temporary path (including spaces) and checks parsed shell arguments while retaining the shebang, build-command and PATH assertions; no tests are skipped. The production implementation is unchanged. Python 3.10 and 3.13 each pass all 17 related tests, and flake8 passes. New Windows CI is pending.

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: the tmpbin python -> python2 link breaks in several setups

1 participant