ariatosca-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r..@apache.org
Subject incubator-ariatosca git commit: ARIA-301 Fix issue when installing from wheel
Date Thu, 06 Jul 2017 16:01:56 GMT
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/ARIA-301-environment-marked-dependencies-installation-from-wheel [created] 3e0748749


ARIA-301 Fix issue when installing from wheel

Fixed an issue when installing ARIA from wheel where
environment-marked dependencies would install regardless
of the environment ARIA is installed on.


Project: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/commit/3e074874
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/3e074874
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/3e074874

Branch: refs/heads/ARIA-301-environment-marked-dependencies-installation-from-wheel
Commit: 3e07487498681b2346e5728ffb361afbaa74559a
Parents: 2195e1f
Author: Ran Ziv <ran@gigaspaces.com>
Authored: Thu Jul 6 18:59:42 2017 +0300
Committer: Ran Ziv <ran@gigaspaces.com>
Committed: Thu Jul 6 18:59:42 2017 +0300

----------------------------------------------------------------------
 setup.py | 27 +++++++++++++++++++++------
 1 file changed, 21 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/3e074874/setup.py
----------------------------------------------------------------------
diff --git a/setup.py b/setup.py
index 340cce2..ac0af8b 100644
--- a/setup.py
+++ b/setup.py
@@ -45,14 +45,9 @@ with open(os.path.join(root_dir, 'README.rst')) as readme:
 
 install_requires = []
 
-# We need to parse the requirements for the conditional dependencies to work for wheels creation
-# as well as source dist installation
-with open(os.path.join(root_dir, 'requirements.in')) as requirements:
-    for requirement in requirements.readlines():
-        install_requires.append(requirement.strip())
-
 ssh_requires = [
     'Fabric>=1.13.0, <1.14',
+    # Fabric depends on the pypiwin32 on Windows, but doesn't install it
     "pypiwin32==219 ; sys_platform == 'win32'"
 ]
 
@@ -60,6 +55,26 @@ extras_require = {
     'ssh': ssh_requires
 }
 
+with open(os.path.join(root_dir, 'requirements.in')) as requirements:
+    for requirement in requirements.readlines():
+        requirement = requirement.strip()
+        if not requirement or requirement.startswith('#'):
+            continue  # skip empty and comment lines
+
+        # dependencies which use environment markers have to go in as conditional dependencies
+        # under "extra_require" rather than "install_requires", or otherwise the environment
+        # markers get ignored when installing from wheel. See more here:
+        # https://wheel.readthedocs.io/en/latest/index.html#defining-conditional-dependencies
+        # https://hynek.me/articles/conditional-python-dependencies/
+        if ';' in requirement:
+            package, condition = requirement.split(';')
+            cond_name = ':{0}'.format(condition.strip())
+            extras_require.setdefault(cond_name, [])
+            extras_require[cond_name].append(package.strip())
+        else:
+            install_requires.append(requirement.strip())
+
+
 console_scripts = ['aria = aria.cli.main:main']
 
 


Mime
View raw message