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 [Forced Update!]
Date Thu, 06 Jul 2017 16:32:47 GMT
Repository: incubator-ariatosca
Updated Branches:
  refs/heads/ARIA-301-environment-marked-dependencies-installation-from-wheel 3e0748749 ->
12b42e1b0 (forced update)


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/12b42e1b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/12b42e1b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/12b42e1b

Branch: refs/heads/ARIA-301-environment-marked-dependencies-installation-from-wheel
Commit: 12b42e1b0e8e2f19094128de003970c54ef0fc59
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 19:32:41 2017 +0300

----------------------------------------------------------------------
 setup.py | 35 +++++++++++++++++++++++++++--------
 1 file changed, 27 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/12b42e1b/setup.py
----------------------------------------------------------------------
diff --git a/setup.py b/setup.py
index 340cce2..91afdd0 100644
--- a/setup.py
+++ b/setup.py
@@ -45,21 +45,40 @@ 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.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:
+            requirement = requirement.split('#')[0]  # get rid of trailing comment, if any
+            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