From b1bf32ed1b633d31bad078b2ab2fd5daaa9c4a2c Mon Sep 17 00:00:00 2001 From: Sam Roberts Date: Thu, 3 Oct 2019 08:42:36 -0700 Subject: [PATCH] doc: clarify Python configuration, etc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Clarify that: - node-gyp is not used to build Node.js - PYTHON can be used to add a Python search path - NODE_GYP_FORCE_PYTHON can be used to override all Python search paths - That a compatible Python is searched for PR-URL: https://github.com/nodejs/node-gyp/pull/1908 Reviewed-By: Christian Clauss Reviewed-By: Rod Vagg Reviewed-By: João Reis Reviewed-By: Richard Lau --- README.md | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 118e720964..7597f03c85 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,12 @@ # `node-gyp` - Node.js native addon build tool -`node-gyp` is a cross-platform command-line tool written in Node.js for compiling -native addon modules for Node.js. It bundles the [gyp](https://gyp.gsrc.io) -project used by the Chromium team and takes away the pain of dealing with the -various differences in build platforms. +`node-gyp` is a cross-platform command-line tool written in Node.js for +compiling native addon modules for Node.js. It contains a fork of the +[gyp](https://gyp.gsrc.io) project that was previously used by the Chromium +team and takes away the pain of dealing with the various differences in build +platforms. + +Note that `node-gyp` is _not_ used to build Node.js itself. Multiple target versions of Node.js are supported (i.e. `0.8`, ..., `4`, `5`, `6`, etc.), regardless of what version of Node.js is actually installed on your system @@ -25,7 +28,9 @@ $ npm install -g node-gyp You will also need to install: -NOTE: node-gyp is compatible with Python v2.7, v3.5, v3.6, or v3.7 but node itself is not yet compatible with Python 3. +NOTE: node-gyp is compatible with Python v2.7, v3.5, v3.6, or v3.7. If the +Python to use is not explicitly configured (see "Configuring Python Dependency" +below) it will attempt to find a compatible Python executable. ### On Unix @@ -76,6 +81,14 @@ value: $ npm config set python /path/to/executable/python ``` +If the `PYTHON` environment variable is set to the path of a Python executable, +it will be used if it is a compatible Python. + +If the `NODE_GYP_FORCE_PYTHON` environment variable is set to the path of a +Python executable, it will be used instead of any of the other configured or +builtin Python search paths. If its not a compatible Python, no further +searching will be done. + ## How to Use To compile your native addon, first go to its root directory: