URL: https://github.com/freeipa/freeipa/pull/744
Author: tiran
 Title: #744: [4.5] Correct PyPI package dependencies
Action: opened

PR body:
"""
* Remove unused install requires from ipapython
* Add missing requirements to ipaserver
* Correct dependencies for yubico otptoken
* Python 2 uses python-ldap, Python 3 pyldap

https://pagure.io/freeipa/issue/6875

Signed-off-by: Christian Heimes <chei...@redhat.com>
"""

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

* Remove unused install requires from ipapython
* Add missing requirements to ipaserver
* Correct dependencies for yubico otptoken
* Python 2 uses python-ldap, Python 3 pyldap

https://pagure.io/freeipa/issue/6875

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

diff --git a/ipaclient/setup.py b/ipaclient/setup.py
index ccb5396..d39235a 100644
--- a/ipaclient/setup.py
+++ b/ipaclient/setup.py
@@ -54,8 +54,6 @@
             "ipalib",
             "ipapython",
             "jinja2",
-            "python-yubico",
-            "pyusb",
             "qrcode",
             "six",
         ],
@@ -66,7 +64,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 2fc039f..10d3831 100755
--- a/ipapython/setup.py
+++ b/ipapython/setup.py
@@ -41,17 +41,15 @@
             "cryptography",
             "dnspython",
             "gssapi",
-            "jwcrypto",
             # "ipalib",  # circular dependency
-            "pyldap",
             "netaddr",
             "netifaces",
             "python-nss",
-            "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 42b0c1b..f48cef4 100755
--- a/ipaserver/setup.py
+++ b/ipaserver/setup.py
@@ -55,17 +55,12 @@
             "ipalib",
             "ipaplatform",
             "ipapython",
+            "jwcrypto",
             "lxml",
             "netaddr",
             "pyasn1",
-            "pyldap",
+            "requests",
             "six",
-            # not available on PyPI
-            # "python-libipa_hbac",
-            # "python-sss",
-            # "python-sss-murmur",
-            # "python-SSSDConfig",
-            # "samba-python",
         ],
         entry_points={
             'custodia.authorizers': [
@@ -75,4 +70,13 @@
                 'IPASecStore = ipaserver.secrets.store:IPASecStore',
             ],
         },
+        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"],
+            "install": ["SSSDConfig"],
+            "trust": ["pysss_murmur", "pysss_nss_idmap"],
+        }
     )
diff --git a/ipasetup.py.in b/ipasetup.py.in
index 7f9b2c9..245038d 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 2f67ec4..c6c9cb6 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", "python-nss"],
             "webui": ["selenium", "pyyaml", "ipaserver"],
-- 
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