Skip to content

Commit

Permalink
only support python3 for creating binaries (#669)
Browse files Browse the repository at this point in the history
Also explicitly use python3 in creating virtualenv for make commands.
  • Loading branch information
tamarrow committed Jul 7, 2016
1 parent 18e80eb commit 77afc61
Show file tree
Hide file tree
Showing 14 changed files with 32 additions and 46 deletions.
2 changes: 1 addition & 1 deletion bin/env.sh
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion cli/Makefile
Expand Up @@ -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
Expand Down
16 changes: 16 additions & 0 deletions 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
2 changes: 1 addition & 1 deletion cli/bin/env.sh
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion cli/bin/test-binary.sh
Expand Up @@ -4,13 +4,14 @@ 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
else
export DCOS_CONFIG=tests/data/dcos.toml
$BASEDIR/env/Scripts/activate
fi

export PATH=$BASEDIR/dist:$PATH
py.test tests/integrations
deactivate
7 changes: 3 additions & 4 deletions cli/binary/Dockerfile.linux-binary
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions cli/binary/binary.spec
Expand Up @@ -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'),
Expand Down
2 changes: 1 addition & 1 deletion cli/dcoscli/main.py
Expand Up @@ -113,4 +113,4 @@ def signal_handler(signal, frame):
sys.exit(0)

if __name__ == "__main__":
main()
sys.exit(main())
5 changes: 1 addition & 4 deletions cli/setup.py
Expand Up @@ -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',
],
Expand All @@ -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
Expand Down
10 changes: 1 addition & 9 deletions 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 =
Expand All @@ -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}
10 changes: 1 addition & 9 deletions 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 =
Expand All @@ -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}
3 changes: 0 additions & 3 deletions setup.py
Expand Up @@ -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',
],
Expand All @@ -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',
Expand Down
6 changes: 1 addition & 5 deletions tox.ini
@@ -1,5 +1,5 @@
[tox]
envlist = py34-syntax, py{27,34}-unit
envlist = py34-syntax, py34-unit

[testenv]
deps =
Expand All @@ -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
6 changes: 1 addition & 5 deletions tox.win.ini
@@ -1,5 +1,5 @@
[tox]
envlist = py{27,34}-unit
envlist = py34-unit

[testenv]
setenv =
Expand All @@ -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

0 comments on commit 77afc61

Please sign in to comment.