From 1a2b7f84c46252af96a6042f142a2fbab9c14f56 Mon Sep 17 00:00:00 2001 From: Mike Crute Date: Sun, 1 Oct 2017 03:49:47 +0000 Subject: Pick crypto package based on runtime version --- .travis.yml | 5 +++-- setup.py | 38 ++++++++++++++++++++++++-------------- 2 files changed, 27 insertions(+), 16 deletions(-) diff --git a/.travis.yml b/.travis.yml index d792753..c561420 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,7 +8,8 @@ python: before_script: # Travis versions of these are really outdated - pip install -U mock nose pytest - # Install wheel with pip instead of building from source - - pip install cryptography + # Install wheel with pip instead of building from source but only for + # Python 2 and 3.3 + - if [[ $TRAVIS_PYTHON_VERSION == 2* || $TRAVIS_PYTHON_VERSION == '3.3' ]]; then pip install cryptography; fi script: - python setup.py validate diff --git a/setup.py b/setup.py index 431775d..36a17c5 100755 --- a/setup.py +++ b/setup.py @@ -1,5 +1,6 @@ #!/usr/bin/env python +import sys import itertools from setuptools.command.test import test from setuptools import setup, find_packages @@ -38,6 +39,27 @@ class TestsWithCoverage(test, object): cov.html_report() +requires = { + "setup_requires": [ + "wheel", + "flake8>=3.3", + ], + "tests_require": [ + "mock>=2,<3", + "coverage>=4.1,<5", + ], + "install_requires": [ + "requests>=2,<3", + ], +} + + +if sys.version_info.major == 3 and sys.version_info.minor >= 4: + requires["install_requires"].append("blowfish>=0.6.1,<1.0") +else: + requires["install_requires"].append("cryptography>=2,<3") + + setup( name="pydora", version="1.10.0", @@ -51,19 +73,6 @@ setup( cmdclass={ "test": TestsWithCoverage, }, - setup_requires=[ - "wheel", - "flake8>=3.3", - ], - tests_require=[ - "mock>=2,<3", - "coverage>=4.1,<5", - ], - install_requires=[ - 'cryptography>=2,<3;python_version<"3.4"', - 'blowfish<1.0;python_version>="3.4"', - "requests>=2,<3", - ], entry_points={ "console_scripts": [ "pydora = pydora.player:main", @@ -84,5 +93,6 @@ setup( "Programming Language :: Python :: 3.6", "Topic :: Internet :: WWW/HTTP", "Topic :: Multimedia :: Sound/Audio :: Players", - ] + ], + **requires ) -- cgit v1.2.3