From 77afc61fc69a52a0e4d9aec0fc2e7cd16a0de463 Mon Sep 17 00:00:00 2001 From: tamarrow Date: Wed, 6 Jul 2016 18:33:33 -0700 Subject: [PATCH] only support python3 for creating binaries (#669) Also explicitly use python3 in creating virtualenv for make commands. --- bin/env.sh | 2 +- cli/Makefile | 2 +- cli/bin/create-binary.sh | 16 ++++++++++++++++ cli/bin/env.sh | 2 +- cli/bin/test-binary.sh | 3 ++- cli/binary/Dockerfile.linux-binary | 7 +++---- cli/binary/binary.spec | 4 ++-- cli/dcoscli/main.py | 2 +- cli/setup.py | 5 +---- cli/tox.ini | 10 +--------- cli/tox.win.ini | 10 +--------- setup.py | 3 --- tox.ini | 6 +----- tox.win.ini | 6 +----- 14 files changed, 32 insertions(+), 46 deletions(-) create mode 100755 cli/bin/create-binary.sh diff --git a/bin/env.sh b/bin/env.sh index 6e639481d..9b1a8e125 100755 --- a/bin/env.sh +++ b/bin/env.sh @@ -4,7 +4,7 @@ BASEDIR=`dirname $0`/.. if [ ! -d "$BASEDIR/env" ]; then - virtualenv -q $BASEDIR/env --prompt='(dcos) ' + virtualenv -p python3 -q $BASEDIR/env --prompt='(dcos) ' echo "Virtualenv created." if [ -f "$BASEDIR/env/bin/activate" ]; then diff --git a/cli/Makefile b/cli/Makefile index 5a1af5977..23c45a1c7 100644 --- a/cli/Makefile +++ b/cli/Makefile @@ -10,7 +10,7 @@ test: env bin/test.sh binary: clean env packages - pyinstaller binary/binary.spec + bin/create-binary.sh test-binary: binary bin/test-binary.sh diff --git a/cli/bin/create-binary.sh b/cli/bin/create-binary.sh new file mode 100755 index 000000000..5554d1138 --- /dev/null +++ b/cli/bin/create-binary.sh @@ -0,0 +1,16 @@ +#!/bin/bash -e + +BASEDIR=`dirname $0`/.. + +cd $BASEDIR + +if [ -f "$BASEDIR/env/bin/activate" ]; then + source $BASEDIR/env/bin/activate +else + $BASEDIR/env/Scripts/activate +fi + +pip install pyinstaller==3.1.1 +pyinstaller $BASEDIR/binary/binary.spec + +deactivate diff --git a/cli/bin/env.sh b/cli/bin/env.sh index aea1a0bd0..04be27daa 100755 --- a/cli/bin/env.sh +++ b/cli/bin/env.sh @@ -4,7 +4,7 @@ BASEDIR=`dirname $0`/.. if [ ! -d "$BASEDIR/env" ]; then - virtualenv -q $BASEDIR/env --prompt='(dcoscli) ' + virtualenv -p python3 -q $BASEDIR/env --prompt='(dcoscli) ' echo "Virtualenv created." if [ -f "$BASEDIR/env/bin/activate" ]; then diff --git a/cli/bin/test-binary.sh b/cli/bin/test-binary.sh index 952c57c72..1f971a1f4 100755 --- a/cli/bin/test-binary.sh +++ b/cli/bin/test-binary.sh @@ -4,7 +4,6 @@ BASEDIR=`dirname $0`/.. cd $BASEDIR -PATH=$(pwd)/dist:$PATH if [ -f "$BASEDIR/env/bin/activate" ]; then cp tests/data/dcos.toml $DCOS_CONFIG source $BASEDIR/env/bin/activate @@ -12,5 +11,7 @@ else export DCOS_CONFIG=tests/data/dcos.toml $BASEDIR/env/Scripts/activate fi + +export PATH=$BASEDIR/dist:$PATH py.test tests/integrations deactivate diff --git a/cli/binary/Dockerfile.linux-binary b/cli/binary/Dockerfile.linux-binary index 394121455..95baa232a 100644 --- a/cli/binary/Dockerfile.linux-binary +++ b/cli/binary/Dockerfile.linux-binary @@ -11,10 +11,9 @@ RUN apt-get update && apt-get install -y \ git \ sudo \ && sudo apt-get update --fix-missing \ -&& sudo apt-get install -y python-dev build-essential \ -&& sudo apt-get install -y python-pip python-virtualenv \ -&& pip install pip --upgrade \ -&& pip install pyinstaller +&& sudo apt-get install -y python-dev build-essential python-virtualenv python3-pip python3-virtualenv \ +&& pip3 install pip --upgrade \ +&& python3 -m pip install pyinstaller==3.1.1 ADD . /dcos-cli WORKDIR /dcos-cli diff --git a/cli/binary/binary.spec b/cli/binary/binary.spec index 726e31fc9..211840982 100644 --- a/cli/binary/binary.spec +++ b/cli/binary/binary.spec @@ -6,8 +6,8 @@ block_cipher = None a = Analysis(['../dcoscli/main.py'], pathex=[os.path.dirname(os.getcwd()), os.getcwd(), - 'env/lib/python2.7/site-packages', - '../env/lib/python2.7/site-packages', + 'env/lib/python3.4/site-packages', + '../env/lib/python3.4/site-packages', ], binaries=None, datas=[('../dcoscli/data/help/*', 'dcoscli/data/help'), diff --git a/cli/dcoscli/main.py b/cli/dcoscli/main.py index 4d7220d0d..de9cced84 100644 --- a/cli/dcoscli/main.py +++ b/cli/dcoscli/main.py @@ -113,4 +113,4 @@ def signal_handler(signal, frame): sys.exit(0) if __name__ == "__main__": - main() + sys.exit(main()) diff --git a/cli/setup.py b/cli/setup.py index 0941da49c..db5dd779a 100644 --- a/cli/setup.py +++ b/cli/setup.py @@ -47,8 +47,6 @@ # Specify the Python versions you support here. In particular, ensure # that you indicate whether you support Python 2, Python 3 or both. - 'Programming Language :: Python :: 2', - 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.4', ], @@ -70,8 +68,7 @@ 'pkginfo==1.2.1', 'toml>=0.9, <1.0', 'virtualenv>=13.0, <14.0', - 'rollbar>=0.9, <1.0', - 'futures>=3.0, <4.0' + 'rollbar>=0.9, <1.0' ], # If there are data files included in your packages that need to be diff --git a/cli/tox.ini b/cli/tox.ini index 541885a95..5ea7cd846 100644 --- a/cli/tox.ini +++ b/cli/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py34-syntax, py{27,34}-unit, py{27,34}-integration +envlist = py34-syntax, py34-unit, py34-integration [testenv] deps = @@ -20,18 +20,10 @@ commands = flake8 --verbose {env:CI_FLAGS:} dcoscli tests setup.py isort --recursive --check-only --diff --verbose dcoscli tests setup.py -[testenv:py27-integration] -commands = - py.test -p no:cacheprovider -vv -x {env:CI_FLAGS:} tests/integrations{posargs} - [testenv:py34-integration] commands = py.test -p no:cacheprovider -vv -x {env:CI_FLAGS:} tests/integrations{posargs} -[testenv:py27-unit] -commands = - py.test -p no:cacheprovider -vv {env:CI_FLAGS:} tests/unit{posargs} - [testenv:py34-unit] commands = py.test -p no:cacheprovider -vv {env:CI_FLAGS:} tests/unit{posargs} diff --git a/cli/tox.win.ini b/cli/tox.win.ini index 2da45e68c..e92928842 100644 --- a/cli/tox.win.ini +++ b/cli/tox.win.ini @@ -1,5 +1,5 @@ [tox] -envlist = py{27,34}-unit, py{27,34}-integration +envlist = py34-unit, py34-integration [testenv] setenv = @@ -22,18 +22,10 @@ commands = flake8 --verbose {env:CI_FLAGS:} dcoscli tests setup.py isort --recursive --check-only --diff --verbose dcoscli tests setup.py -[testenv:py27-integration] -commands = - py.test -vv {env:CI_FLAGS:} tests/integrations{posargs} - [testenv:py34-integration] commands = py.test -vv {env:CI_FLAGS:} tests/integrations{posargs} -[testenv:py27-unit] -commands = - py.test -vv {env:CI_FLAGS:} tests/unit{posargs} - [testenv:py34-unit] commands = py.test -vv {env:CI_FLAGS:} tests/unit{posargs} diff --git a/setup.py b/setup.py index 8a3a5311f..5550b8eae 100755 --- a/setup.py +++ b/setup.py @@ -47,8 +47,6 @@ # Specify the Python versions you support here. In particular, ensure # that you indicate whether you support Python 2, Python 3 or both. - 'Programming Language :: Python :: 2', - 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.4', ], @@ -65,7 +63,6 @@ # requirements files see: # https://packaging.python.org/en/latest/requirements.html install_requires=[ - 'futures>=3.0, <4.0', 'gitpython>=1.0, <2.0', 'jsonschema==2.4', # pin the exact version, jsonschema 2.5 broke py3 'pager>=3.3, <4.0', diff --git a/tox.ini b/tox.ini index 4afcb1645..3d630d0f9 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py34-syntax, py{27,34}-unit +envlist = py34-syntax, py34-unit [testenv] deps = @@ -16,10 +16,6 @@ commands = flake8 --verbose {env:CI_FLAGS:} dcos tests setup.py isort --recursive --check-only --diff --verbose dcos tests setup.py -[testenv:py27-unit] -commands = - py.test -p no:cacheprovider -vv {env:CI_FLAGS:} --cov {envsitepackagesdir}/dcos tests - [testenv:py34-unit] commands = py.test -p no:cacheprovider -vv {env:CI_FLAGS:} --cov {envsitepackagesdir}/dcos tests diff --git a/tox.win.ini b/tox.win.ini index 6aa86078f..9c162f545 100644 --- a/tox.win.ini +++ b/tox.win.ini @@ -1,5 +1,5 @@ [tox] -envlist = py{27,34}-unit +envlist = py34-unit [testenv] setenv = @@ -18,10 +18,6 @@ commands = flake8 --verbose {env:CI_FLAGS:} dcos tests setup.py isort --recursive --check-only --diff --verbose dcos tests setup.py -[testenv:py27-unit] -commands = - py.test -vv {env:CI_FLAGS:} --cov {envsitepackagesdir}/dcos tests - [testenv:py34-unit] commands = py.test -vv {env:CI_FLAGS:} --cov {envsitepackagesdir}/dcos tests