nodejs / nodejs/node-gyp

NODE_GYP_FORCE_PYTHON doesn't affect gyp-mac-tool

Open
#2,146 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Python
Dominant language
Python
Stars
10.7k
Forks
1.9k
Avg merge
1d 4h
Merged PRs (30d)
5

Description

Node 12.14.1
macOS 10.15.5
node-gyp 5.1.1

Setting the environment variable NODE_GYP_FORCE_PYTHON seems to work for most things, but it doesn't change the Python version used by "gyp-mac-tool". I think the problem is that even though "gyp-mac-tool" is a Python program, it is just run as a generic executable with a shebang line:

#!/usr/bin/env python

So it ends up using whatever "python" is in the PATH, instead of what PythonFinder returns.

I'm not sure how to fix this...

  • Maybe run "gyp-mac-tool" as "$PYTHON gyp-mac-tool" instead of as a generic executable? Does this require changes to gyp?
  • Maybe node-gyp can do some temporary symlink/PATH stuff to ensure the right Python gets run?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing PythonFinder in lib/find-python.js and how gyp-mac-tool is invoked during the macOS build. Reproduce the issue with NODE_GYP_FORCE_PYTHON on the reported Node.js and node-gyp versions, then confirm that gyp-mac-tool uses the selected Python interpreter.

Written by the indexing model from the issue text.

Assessment

Tech stack
nodejs, python
Domain
build-system, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.