From 7da04f100cfdc1c9685a2a8c71d467fcf85abff6 Mon Sep 17 00:00:00 2001 From: Philip Jenvey Date: Mon, 16 Oct 2017 15:37:10 -0700 Subject: [PATCH] chore: allow WITH_RUST=false to disable the rust build also update travis to (hopefully) latest pypy Closes: #1046 --- .travis.yml | 10 +++++----- setup.py | 15 ++++++++++----- tox.ini | 2 +- 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4d560859..5009aa14 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,13 +11,13 @@ matrix: include: - python: 2.7 env: TOXENV=py27 DDB=true CODECOV=true - - python: pypy-5.7.1 + - python: pypy env: TOXENV=pypy DDB=true CODECOV=true - - env: TOXENV=flake8 + - env: TOXENV=flake8 WITH_RUST=false - python: 3.6 - env: TOXENV=py36-mypy + env: TOXENV=py36-mypy WITH_RUST=false allow_failures: - - env: TOXENV=py36-mypy + - env: TOXENV=py36-mypy WITH_RUST=false before_install: # https://github.com/travis-ci/travis-ci/issues/7940 @@ -26,7 +26,7 @@ before_install: install: - ${DDB:+make ddb} - pip install tox ${CODECOV:+codecov} -- curl https://sh.rustup.rs | sh -s -- -y +- if [ ${WITH_RUST:-true} != "false" ]; then curl https://sh.rustup.rs | sh -s -- -y || travis_terminate 1; fi - export PATH=$PATH:$HOME/.cargo/bin script: - tox -- ${CODECOV:+--with-coverage --cover-xml --cover-package=autopush} diff --git a/setup.py b/setup.py index de5f9cfe..dc0c09f3 100644 --- a/setup.py +++ b/setup.py @@ -10,9 +10,19 @@ with io.open(os.path.join(here, 'CHANGELOG.md'), encoding='utf8') as f: CHANGES = f.read() +WITH_RUST = os.environ.get('WITH_RUST', 'true').lower() not in ('false', '0') + extra_options = { "packages": find_packages(), } +if WITH_RUST: + extra_options.update( + setup_requires=['snaek'], + install_requires=['snaek'], + snaek_rust_modules=[ + ('autopush_rs._native', 'autopush_rs/'), + ], + ) setup(name="AutoPush", @@ -45,10 +55,5 @@ [nose.plugins] object-tracker = autopush.noseplugin:ObjectTracker """, - setup_requires=['snaek'], - install_requires=['snaek'], - snaek_rust_modules=[ - ('autopush_rs._native', 'autopush_rs/'), - ], **extra_options ) diff --git a/tox.ini b/tox.ini index 30f56570..629eaf6c 100644 --- a/tox.ini +++ b/tox.ini @@ -16,7 +16,7 @@ setenv = with_gmp=no [testenv:flake8] commands = flake8 autopush -deps += flake8 +deps = flake8 [testenv:py36-mypy] commands = mypy autopush