URL: https://github.com/freeipa/freeipa/pull/702
Author: tiran
 Title: #702: Correct PyPI package dependencies
Action: synchronized

To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/702/head:pr702
git checkout pr702
From 608ebabf0501874bcbd469466685343da8cdf709 Mon Sep 17 00:00:00 2001
From: Christian Heimes <chei...@redhat.com>
Date: Mon, 10 Apr 2017 10:00:23 +0200
Subject: [PATCH] Correct PyPI package dependencies

* Remove unused install requires
* Correct dependencies for yubico otptoken
* Add explicit dependency on cffi for csrgen
* Python 2 uses python-ldap, Python 3 pyldap

Signed-off-by: Christian Heimes <chei...@redhat.com>
---
 ipaclient/setup.py |  5 ++---
 ipapython/setup.py |  6 ++----
 ipaserver/setup.py |  3 ++-
 ipasetup.py.in     | 16 ++++++++++++----
 ipatests/setup.py  |  3 ++-
 tox.ini            |  3 +--
 6 files changed, 21 insertions(+), 15 deletions(-)

diff --git a/ipaclient/setup.py b/ipaclient/setup.py
index ccb5396..0140fd5 100644
--- a/ipaclient/setup.py
+++ b/ipaclient/setup.py
@@ -50,12 +50,11 @@
             ],
         },
         install_requires=[
+            "cffi",
             "cryptography",
             "ipalib",
             "ipapython",
             "jinja2",
-            "python-yubico",
-            "pyusb",
             "qrcode",
             "six",
         ],
@@ -66,7 +65,7 @@
         },
         extras_require={
             "install": ["ipaplatform"],
-            "otptoken_yubikey": ["yubico", "usb"]
+            "otptoken_yubikey": ["python-yubico", "pyusb"],
         },
         zip_safe=False,
     )
diff --git a/ipapython/setup.py b/ipapython/setup.py
index f4bc3f8..4f71530 100755
--- a/ipapython/setup.py
+++ b/ipapython/setup.py
@@ -41,16 +41,14 @@
             "cryptography",
             "dnspython",
             "gssapi",
-            "jwcrypto",
             # "ipalib",  # circular dependency
-            "pyldap",
             "netaddr",
             "netifaces",
-            "requests",
             "six",
         ],
         extras_require={
-            ":python_version<'3'": ["enum34"],
+            ":python_version<'3'": ["enum34", "python-ldap"],
+            ":python_version>='3'": ["pyldap"],
             "install": ["dbus-python"],  # for certmonger
         },
     )
diff --git a/ipaserver/setup.py b/ipaserver/setup.py
index 097508f..307e7a8 100755
--- a/ipaserver/setup.py
+++ b/ipaserver/setup.py
@@ -58,7 +58,6 @@
             "lxml",
             "netaddr",
             "pyasn1",
-            "pyldap",
             "six",
         ],
         entry_points={
@@ -70,6 +69,8 @@
             ],
         },
         extras_require={
+            ":python_version<'3'": ["python-ldap"],
+            ":python_version>='3'": ["pyldap"],
             # These packages are currently not available on PyPI.
             "dcerpc": ["samba", "pysss", "pysss_nss_idmap"],
             "hbactest": ["pyhbac"],
diff --git a/ipasetup.py.in b/ipasetup.py.in
index b0a5051..2ad57e2 100644
--- a/ipasetup.py.in
+++ b/ipasetup.py.in
@@ -101,6 +101,7 @@ common_args = dict(
         "Programming Language :: Python :: 2.7",
         "Programming Language :: Python :: 3",
         "Programming Language :: Python :: 3.5",
+        "Programming Language :: Python :: 3.6",
         "Programming Language :: Python :: Implementation :: CPython",
         "Operating System :: POSIX",
         "Operating System :: POSIX :: Linux",
@@ -138,13 +139,20 @@ def ipasetup(name, doc, **kwargs):
     cmdclass = setup_kwargs.setdefault('cmdclass', {})
     cmdclass['build_py'] = build_py
 
-    # Env markers like ":python_version<'3.3'" are not supported by
+    # Env markers like ":python_version<'3'" are not supported by
     # setuptools < 18.0.
     if 'extras_require' in setup_kwargs and SETUPTOOLS_VERSION < (18, 0, 0):
         for k in list(setup_kwargs['extras_require']):
-            if k.startswith(':'):
-                req = setup_kwargs.setdefault('install_requires', [])
-                req.extend(setup_kwargs['extras_require'].pop(k))
+            if not k.startswith(':'):
+                continue
+            values = setup_kwargs['extras_require'].pop(k)
+            req = setup_kwargs.setdefault('install_requires', [])
+            if k == ":python_version<'3'" and sys.version_info.major == 2:
+                req.extend(values)
+            elif k == ":python_version>='3'" and sys.version_info.major >= 3:
+                req.extend(values)
+            else:
+                raise ValueError(k, values)
 
     os.chdir(local_path)
     try:
diff --git a/ipatests/setup.py b/ipatests/setup.py
index 4c02c79..00b9334 100644
--- a/ipatests/setup.py
+++ b/ipatests/setup.py
@@ -68,12 +68,13 @@
             "ipapython",
             "nose",
             "polib",
-            "pyldap",
             "pytest",
             "pytest_multihost",
             "six",
         ],
         extras_require={
+            ":python_version<'3'": ["python-ldap"],
+            ":python_version>='3'": ["pyldap"],
             "integration": ["dbus-python", "pyyaml", "ipaserver"],
             "ipaserver": ["ipaserver"],
             "webui": ["selenium", "pyyaml", "ipaserver"],
diff --git a/tox.ini b/tox.ini
index db551df..ccface9 100644
--- a/tox.ini
+++ b/tox.ini
@@ -22,8 +22,7 @@ commands=
 [testenv:pylint2]
 basepython=python2.7
 deps=
-    ipaclient
-    ipapython[certmonger]
+    ipaclient[otptoken_yubikey]
     pylint
 commands=
     {envpython} -m pylint \
-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code

Reply via email to