From a78b584236e92a9469f72916c55ba83e9819ddea Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Sun, 14 Feb 2021 05:51:19 +0100 Subject: [PATCH] gyp: remove support for Python 2 (#2300) PR-URL: https://github.com/nodejs/node-gyp/pull/2300 Reviewed-By: Jiawen Geng --- README.md | 14 ++++---------- gyp/pylib/gyp/MSVSSettings.py | 2 -- gyp/pylib/gyp/generator/android.py | 4 +++- test/fixtures/test-charmap.py | 7 +++---- 4 files changed, 10 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 64e82dbbe3..8c37b210db 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ Depending on your operating system, you will need to install: ### On Unix - * Python v2.7, v3.5, v3.6, v3.7, or v3.8 + * Python v3.6, v3.7, v3.8, or v3.9 * `make` * A proper C/C++ compiler toolchain, like [GCC](https://gcc.gnu.org) @@ -38,7 +38,7 @@ Depending on your operating system, you will need to install: **ATTENTION**: If your Mac has been _upgraded_ to macOS Catalina (10.15), please read [macOS_Catalina.md](macOS_Catalina.md). - * Python v2.7, v3.5, v3.6, v3.7, or v3.8 + * Python v3.6, v3.7, v3.8, or v3.9 * [Xcode](https://developer.apple.com/xcode/download/) * You also need to install the `XCode Command Line Tools` by running `xcode-select --install`. Alternatively, if you already have the full Xcode installed, you can find them under the menu `Xcode -> Open Developer Tool -> More Developer Tools...`. This step will install `clang`, `clang++`, and `make`. @@ -46,12 +46,6 @@ Depending on your operating system, you will need to install: Install the current version of Python from the [Microsoft Store package](https://docs.python.org/3/using/windows.html#the-microsoft-store-package). -#### Option 1 - -Install all the required tools and configurations using Microsoft's [windows-build-tools](https://github.com/felixrieseberg/windows-build-tools) using `npm install --global windows-build-tools` from an elevated PowerShell or CMD.exe (run as Administrator). - -#### Option 2 - Install tools and configuration manually: * Install Visual C++ Build Environment: [Visual Studio Build Tools](https://visualstudio.microsoft.com/thank-you-downloading-visual-studio/?sku=BuildTools) (using "Visual C++ build tools" workload) or [Visual Studio 2017 Community](https://visualstudio.microsoft.com/pl/thank-you-downloading-visual-studio/?sku=Community) @@ -64,8 +58,8 @@ Install tools and configuration manually: ### Configuring Python Dependency -`node-gyp` requires that you have installed a compatible version of Python, one of: v2.7, v3.5, v3.6, -v3.7, or v3.8. If you have multiple Python versions installed, you can identify which Python +`node-gyp` requires that you have installed a compatible version of Python, one of: v3.6, v3.7, +v3.8, or v3.9. If you have multiple Python versions installed, you can identify which Python version `node-gyp` should use in one of the following ways: 1. by setting the `--python` command-line option, e.g.: diff --git a/gyp/pylib/gyp/MSVSSettings.py b/gyp/pylib/gyp/MSVSSettings.py index e89a971a3b..87c20041e3 100644 --- a/gyp/pylib/gyp/MSVSSettings.py +++ b/gyp/pylib/gyp/MSVSSettings.py @@ -22,12 +22,10 @@ _msvs_validators = {} _msbuild_validators = {} - # A dictionary of settings converters. The key is the tool name, the value is # a dictionary mapping setting names to conversion functions. _msvs_to_msbuild_converters = {} - # Tool name mapping from MSVS to MSBuild. _msbuild_name_of_tool = {} diff --git a/gyp/pylib/gyp/generator/android.py b/gyp/pylib/gyp/generator/android.py index 040d8088a2..fe1be3c858 100644 --- a/gyp/pylib/gyp/generator/android.py +++ b/gyp/pylib/gyp/generator/android.py @@ -486,7 +486,9 @@ def WriteCopies(self, copies, extra_outputs): self.LocalPathify(os.path.join(copy["destination"], filename)) ) - self.WriteLn(f"{output}: {path} $(GYP_TARGET_DEPENDENCIES) | $(ACP)") + self.WriteLn( + f"{output}: {path} $(GYP_TARGET_DEPENDENCIES) | $(ACP)" + ) self.WriteLn("\t@echo Copying: $@") self.WriteLn("\t$(hide) mkdir -p $(dir $@)") self.WriteLn("\t$(hide) $(ACP) -rpf $< $@") diff --git a/test/fixtures/test-charmap.py b/test/fixtures/test-charmap.py index b338f915bc..033eb9bcf4 100644 --- a/test/fixtures/test-charmap.py +++ b/test/fixtures/test-charmap.py @@ -1,4 +1,3 @@ -from __future__ import print_function import sys import locale @@ -18,9 +17,9 @@ def main(): pass textmap = { - 'cp936': u'\u4e2d\u6587', - 'cp1252': u'Lat\u012Bna', - 'cp932': u'\u306b\u307b\u3093\u3054' + 'cp936': '\u4e2d\u6587', + 'cp1252': 'Lat\u012Bna', + 'cp932': '\u306b\u307b\u3093\u3054' } if encoding in textmap: print(textmap[encoding])