Repository: libcloud Updated Branches: refs/heads/trunk e90e75934 -> 88e3c822b
Consistent logic for dependencies resolution Different versions of Python have different dependencies. These differences are parsed in various ways. This pull request establishes a consistent method for setting dependencies per version. In addition, the code from `backports.ssl_match_hostname` has been merged into the standard library in Python 2.7.9. The condition for adding that dependency now takes into account that fact. https://www.python.org/downloads/release/python-279/ > The entirety of Python 3.4's ssl module has been backported for Python 2.7.9. > See PEP 466 for justification. Signed-off-by: Tomaz Muraus <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/45b83c49 Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/45b83c49 Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/45b83c49 Branch: refs/heads/trunk Commit: 45b83c4932cb72fecc139b87921eb5db3aaa7c3b Parents: e90e759 Author: cgtx <[email protected]> Authored: Fri Mar 13 16:26:58 2015 -0500 Committer: Tomaz Muraus <[email protected]> Committed: Sat Mar 14 21:52:05 2015 +0100 ---------------------------------------------------------------------- setup.py | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/libcloud/blob/45b83c49/setup.py ---------------------------------------------------------------------- diff --git a/setup.py b/setup.py index 032fbad..2f70015 100644 --- a/setup.py +++ b/setup.py @@ -33,6 +33,16 @@ from libcloud.utils.dist import get_packages, get_data_files libcloud.utils.misc.SHOW_DEPRECATION_WARNING = False +# Different versions of python have different requirements. We can't use +# libcloud.utils.py3 here because it relies on backports dependency being +# installed / available +PY2 = sys.version_info.major == 2 +PY3 = sys.version_info.major == 3 +pre_PY25 = PY2 and sys.version_info < (2, 5) +pre_PY26 = PY2 and sys.version_info < (2, 6) +pre_PY279 = PY2 and sys.version_info < (2, 7, 9) +pre_PY32 = PY3 and sys.version_info < (3, 2) +post_PY27 = PY2 and sys.version_info >= (2, 7) HTML_VIEWSOURCE_BASE = 'https://svn.apache.org/viewvc/libcloud/trunk' PROJECT_BASE_DIR = 'http://libcloud.apache.org' @@ -49,26 +59,20 @@ TEST_REQUIREMENTS = [ 'mock' ] -if sys.version_info < (3, 2): +if pre_PY279 or pre_PY32: TEST_REQUIREMENTS.append('backports.ssl_match_hostname') -# Note: we can't use libcloud.utils.py3 here because it relies on backports -# dependency being installed / available -if sys.version_info >= (2, 7): +if post_PY27 or PY3: unittest2_required = False else: unittest2_required = True -if sys.version_info <= (2, 4): +if pre_PY25: version = '.'.join([str(x) for x in sys.version_info[:3]]) print('Version ' + version + ' is not supported. Supported versions are ' + ', '.join(SUPPORTED_VERSIONS)) sys.exit(1) -# pre-2.6 will need the ssl PyPI package -pre_python26 = (sys.version_info[0] == 2 and sys.version_info[1] < 6) - - def read_version_string(): version = None sys.path.insert(0, pjoin(os.getcwd())) @@ -146,7 +150,7 @@ class TestCommand(Command): print("Please copy the new secrets.py-dist file over otherwise" + " tests might fail") - if pre_python26: + if pre_PY26: missing = [] # test for dependencies try: @@ -231,10 +235,10 @@ class CoverageCommand(Command): forbid_publish() install_requires = [] -if pre_python26: +if pre_PY26: install_requires.extend(['ssl', 'simplejson']) -if sys.version_info < (3, 2): +if pre_PY279 or pre_PY32: install_requires.append('backports.ssl_match_hostname') setup(
