This repository was archived by the owner on Dec 15, 2022. It is now read-only.
Respect a user's PYTHON or npm_config_python settings #703
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.
Requirements
Description of the Change
This captures the various ways that node-gyp can find its Python executable within the entrypoint scripts and forwards them to the Python interceptor script as
ATOM_APM_ORIGINAL_PYTHON
. python-interceptor then execsATOM_APM_ORIGINAL_PYTHON
instead of a hardcoded "python".Furthermore, this deals with some odd edge cases related to
npm
being case-insensitive when it readsnpm_config_*
variables from its environment. If a user had something likeNPM_CONFIG_PYTHON
ornpm_CONFIG_node_GYP
set in their environment the results would technically be undefined. 🌈Alternate Designs
I considered using
npm config set
andnpm config get
to use npm itself for precedence rules, butnpm config get
reported "undefined" for unset variables instead of a blank string (and returns with a 0 status), which makes it awkward to use in scripts.Benefits
#673 introduced a regression: apm no longer respects a user's external
PYTHON
ornpm_config_python
settings. This causes problems on systems where the default Python executable is not compatible with node-gyp. With this change, those settings are respected in a way which is consistent with the behavior of a plainnpm install
.Possible Drawbacks
This uses bash syntax pattern substitution constructs like
${..##}
and${..%%}
which may not be portable to all shell environments. The shebang in ourapm
andnpm
scripts was already#!/bin/bash
, though, so we should be no less portable than we were before.Applicable Issues
Fixes #698.