ariatosca-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From emblempar...@apache.org
Subject [2/4] incubator-ariatosca git commit: ARIA-301 Fix issue when installing from wheel
Date Mon, 10 Jul 2017 08:59:16 GMT
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/a93a5dfa
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/a93a5dfa
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/a93a5dfa

Branch: refs/heads/ARIA-254-multiple-nodes-per-template
Commit: a93a5dfafffdf3babe25a51993be651cdae3af65
Parents: 2195e1f
Author: Ran Ziv <ran@gigaspaces.com>
Authored: Thu Jul 6 18:59:42 2017 +0300
Committer: Ran Ziv <ran@gigaspaces.com>
Committed: Sun Jul 9 10:06:43 2017 +0300

----------------------------------------------------------------------
 setup.py | 34 ++++++++++++++++++++++++++--------
 1 file changed, 26 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/a93a5dfa/setup.py
----------------------------------------------------------------------
diff --git a/setup.py b/setup.py
index 340cce2..8e95c19 100644
--- a/setup.py
+++ b/setup.py
@@ -45,21 +45,39 @@ 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',
-    "pypiwin32==219 ; sys_platform == 'win32'"
+]
+win_ssh_requires = [
+    # Fabric depends on the pypiwin32 on Windows, but doesn't install it
+    'pypiwin32==219'
 ]
 
 extras_require = {
-    'ssh': ssh_requires
+    'ssh': ssh_requires,
+    'ssh:sys_platform=="win32"': win_ssh_requires
 }
 
+with open(os.path.join(root_dir, 'requirements.in')) as requirements:
+    for requirement in requirements.readlines():
+        requirement = requirement.split('#')[0].strip()  # get rid of comments or trailing
comments
+        if not requirement:
+            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)
+
+
 console_scripts = ['aria = aria.cli.main:main']
 
 


Mime
View raw message