From 07e2123c985065e243223f763a542c23839758f3 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Tue, 6 Oct 2020 15:31:17 +0800 Subject: [PATCH 1/2] tests: support python releases before 3.7 the "capture_output" parameter of subprocess.run() was introduced in python3.7. and subprocess.run() does not exist in python2. so should not rely on them unless we drop the support of python2 and python3.6 Signed-off-by: Kefu Chai --- tests/nodeenv_test.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/tests/nodeenv_test.py b/tests/nodeenv_test.py index ecf182c..f49cf1d 100644 --- a/tests/nodeenv_test.py +++ b/tests/nodeenv_test.py @@ -3,6 +3,7 @@ import os.path import pipes +import shutil import subprocess import sys import sysconfig @@ -15,11 +16,15 @@ HERE = os.path.abspath(os.path.dirname(__file__)) - -if subprocess.run(["which", "nodejs"],capture_output=True).returncode == 0: - is_nodejs = True -else: - is_nodejs = False +try: + is_nodejs = shutil.which("nodejs") is not None +except AttributeError: + try: + subprocess.check_call(["which", "nodejs"], stdout=subprocess.PIPE) + except subprocess.CalledProcessError: + is_nodejs = False + else: + is_nodejs = True def call_nodejs(ev_path): From 9ac075d10405f944074b66d08e87407e077f1e73 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Tue, 6 Oct 2020 15:42:05 +0800 Subject: [PATCH 2/2] drop python3.4 and python3.5 and add python3.7 as they are not widely used anymore in modern releases of popular distros. Signed-off-by: Kefu Chai --- .travis.yml | 3 +-- README.rst | 2 +- tox.ini | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index b0202e1..ef12b58 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,9 +1,8 @@ language: python python: - 2.7 - - 3.4 - - 3.5 - 3.6 + - 3.7 - pypy install: pip install coveralls tox-travis script: tox diff --git a/README.rst b/README.rst index 3b6819a..43c69a2 100644 --- a/README.rst +++ b/README.rst @@ -75,7 +75,7 @@ Dependency For nodeenv ^^^^^^^^^^^ -* python (2.6+, 3.3+, or pypy) +* python (2.6+, 3.5+, or pypy) * make * tail diff --git a/tox.ini b/tox.ini index 14d48da..80b9ab4 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,6 @@ [tox] # These should match the travis env list -envlist = py27,py34,py35,py36,pypy +envlist = py27,py36,py37,pypy [testenv] install_command = pip install {opts} {packages}