URL: https://github.com/freeipa/freeipa/pull/195
Author: tiran
 Title: #195: [WIP] Make ipaclient pip install-able
Action: synchronized

To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/195/head:pr195
git checkout pr195
From 443c072f9053189b5522020b1fb7ca29d80b85a8 Mon Sep 17 00:00:00 2001
From: Christian Heimes <chei...@redhat.com>
Date: Thu, 27 Oct 2016 14:04:58 +0200
Subject: [PATCH] Add install requirements to Python packages

Signed-off-by: Christian Heimes <chei...@redhat.com>
---
 .gitignore           |  1 -
 Makefile.am          | 21 ++++++++++++++++++++-
 Makefile.python.am   |  6 ++++++
 ipaclient/setup.py   | 14 ++++++++++++++
 ipalib/setup.py      | 11 +++++++++++
 ipaplatform/setup.py | 10 ++++++++++
 ipapython/setup.py   | 23 +++++++++++++++++++++++
 ipaserver/setup.py   | 26 ++++++++++++++++++++++++++
 ipasetup.py.in       | 24 ++++++++++++++++++++++++
 ipatests/setup.py    | 25 ++++++++++++++++++++++++-
 10 files changed, 158 insertions(+), 3 deletions(-)

diff --git a/.gitignore b/.gitignore
index de61aff..2bacc85 100644
--- a/.gitignore
+++ b/.gitignore
@@ -88,4 +88,3 @@ freeipa2-dev-doc
 /ipaplatform/paths.py
 /ipaplatform/services.py
 /ipaplatform/tasks.py
-/ipaplatform/setup.py
diff --git a/Makefile.am b/Makefile.am
index 159d396..807a4f3 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,4 +1,5 @@
-SUBDIRS = asn1 util client contrib daemons init install ipaclient ipalib ipaplatform ipapython ipaserver ipatests po
+IPACLIENT_SUBDIRS = ipaclient ipalib ipaplatform ipapython
+SUBDIRS = asn1 util client contrib daemons init install $(IPACLIENT_SUBDIRS) ipaserver ipatests po
 
 MOSTLYCLEANFILES = ipasetup.pyc ipasetup.pyo \
 		   ignore_import_errors.pyc ignore_import_errors.pyo \
@@ -162,3 +163,21 @@ jslint-ui-test:
 jslint-html:
 	cd $(top_srcdir)/install/html; 				\
 	jsl -nologo -nosummary -nofilelisting -conf jsl.conf
+
+.PHONY: bdist_wheel wheel_bundle
+WHEELDISTDIR = $(top_builddir)/dist/wheels
+WHEELBUNDLEDIR = $(top_builddir)/dist/bundle
+
+$(WHEELDISTDIR):
+	mkdir -p $(WHEELDISTDIR)
+
+$(WHEELBUNDLEDIR):
+	mkdir -p $(WHEELBUNDLEDIR)
+
+bdist_wheel: $(WHEELDISTDIR)
+	for dir in $(IPACLIENT_SUBDIRS); do \
+	    $(MAKE) $(AM_MAKEFLAGS) -C $${dir} $@ || exit 1; \
+	done
+
+wheel_bundle: $(WHEELBUNDLEDIR) bdist_wheel
+	$(PYTHON) -m pip wheel --wheel-dir $(WHEELBUNDLEDIR) $(WHEELDISTDIR)/*.whl
diff --git a/Makefile.python.am b/Makefile.python.am
index 0ea3fcf..2ccd383 100644
--- a/Makefile.python.am
+++ b/Makefile.python.am
@@ -36,3 +36,9 @@ dist-hook:
 		if test -x "$(srcdir)/$${FILEN}"; then MODE=755; else MODE=644; fi;	\
 		$(INSTALL) -D -m $${MODE} "$(srcdir)/$${FILEN}" "$(distdir)/$${FILEN}" || exit $$?;	\
 	done
+
+WHEELDISTDIR = $(top_builddir)/dist/wheels
+.PHONY: bdist_wheel
+bdist_wheel:
+	rm -rf $(WHEELDISTDIR)/$(pkgname)*.whl
+	$(PYTHON) "$(srcdir)/setup.py" bdist_wheel --dist-dir=$(WHEELDISTDIR)
diff --git a/ipaclient/setup.py b/ipaclient/setup.py
index 722d99d..0a9d075 100644
--- a/ipaclient/setup.py
+++ b/ipaclient/setup.py
@@ -43,4 +43,18 @@
             "ipaclient.remote_plugins.2_156",
             "ipaclient.remote_plugins.2_164",
         ],
+        install_requires=[
+            "cryptography",
+            "ipalib",
+            "ipapython",
+            "python-nss",
+            "qrcode",
+            "six",
+        ],
+        setup_requires=[
+            "wheel",
+        ],
+        extra_requires = {
+            "otptoken_yubikey": ["yubico", "usb"]
+        }
     )
diff --git a/ipalib/setup.py b/ipalib/setup.py
index a828c37..98af7ab 100644
--- a/ipalib/setup.py
+++ b/ipalib/setup.py
@@ -36,4 +36,15 @@
             "ipalib",
             "ipalib.install",
         ],
+        install_requires=[
+            "ipaplatform",
+            "ipapython",
+            "netaddr",
+            "pyasn1",
+            "python-nss",
+            "six",
+        ],
+        setup_requires=[
+            "wheel",
+        ],
     )
diff --git a/ipaplatform/setup.py b/ipaplatform/setup.py
index 82499da..97311de 100644
--- a/ipaplatform/setup.py
+++ b/ipaplatform/setup.py
@@ -39,4 +39,14 @@
             "ipaplatform.redhat",
             "ipaplatform.rhel"
         ],
+        install_requires=[
+            "cffi",
+            # "ipalib",  # circular dependency
+            "pyasn1",
+            "python-nss",
+            "six",
+        ],
+        setup_requires=[
+            "wheel",
+        ],
     )
diff --git a/ipapython/setup.py b/ipapython/setup.py
index 47acdd6..0f181ab 100755
--- a/ipapython/setup.py
+++ b/ipapython/setup.py
@@ -38,4 +38,27 @@
             "ipapython.secrets",
             "ipapython.install"
         ],
+        install_requires=[
+            "cffi",
+            "custodia",
+            "cryptography",
+            "dnspython",
+            "gssapi",
+            "jwcrypto",
+            "ipaplatform",
+            # "ipalib",  # circular dependency
+            "pyldap",
+            "lxml",
+            "netaddr",
+            "netifaces",
+            "python-nss",
+            "requests",
+            "six",
+        ],
+        setup_requires=[
+            "wheel",
+        ],
+        extras_require={
+            ":python_version<'3'": ["enum34"],
+        },
     )
diff --git a/ipaserver/setup.py b/ipaserver/setup.py
index 8ce2970..5c38843 100755
--- a/ipaserver/setup.py
+++ b/ipaserver/setup.py
@@ -43,4 +43,30 @@
             'ipaserver.install.plugins',
             'ipaserver.install.server',
         ],
+        install_requires=[
+            "cryptography",
+            "dbus-python",
+            "dnspython",
+            "dogtag-pki",
+            "ipaclient",
+            "ipalib",
+            "ipaplatform",
+            "ipapython",
+            "lxml",
+            "netaddr",
+            "memcache",
+            "pyasn1",
+            "pyldap",
+            "python-nss",
+            "six",
+            # not available on PyPI
+            # "python-libipa_hbac",
+            # "python-sss",
+            # "python-sss-murmur",
+            # "python-SSSDConfig",
+            # "samba-python",
+        ],
+        setup_requires=[
+            "wheel",
+        ],
     )
diff --git a/ipasetup.py.in b/ipasetup.py.in
index 2835527..fcbe47e 100644
--- a/ipasetup.py.in
+++ b/ipasetup.py.in
@@ -18,6 +18,25 @@
 import os
 import sys
 
+
+PACKAGE_VERSION = {
+    'cryptography': 'cryptography >= 0.9',
+    'dnspython': 'dnspython >= 1.11.1',
+    'gssapi': 'gssapi > 1.1.2',
+    'ipaclient': 'ipaclient == @VERSION@',
+    'ipalib': 'ipalib == @VERSION@',
+    'ipaplatform': 'ipaplatform == @VERSION@',
+    'ipapython': 'ipapython == @VERSION@',
+    'ipaserver': 'ipaserver == @VERSION@',
+    'kdcproxy': 'kdcproxy >= 0.3',
+    'netifaces': 'netifaces >= 0.10.4',
+    'python-nss': 'python-nss >= 0.16',
+    'pyldap': 'pyldap >= 2.4.15',
+    'qrcode': 'qrcode >= 5.0',
+    # 'yubico': 'yubico >= 1.2.3',
+}
+
+
 common_args = dict(
     version="@VERSION@",
     license="GPL",
@@ -48,11 +67,16 @@ old_path = os.path.abspath(os.getcwd())
 def ipasetup(name, doc, **kwargs):
     doclines = doc.split("\n")
 
+    install_requires = list(kwargs.pop('install_requires', []))
+    for i, entry in enumerate(install_requires):
+        install_requires[i] = PACKAGE_VERSION.get(entry, entry)
+
     setup_kwargs = common_args.copy()
     setup_kwargs.update(
         name=name,
         description=doclines[0],
         long_description="\n".join(doclines[:2]),
+        install_requires=install_requires,
         **kwargs
     )
     # exclude setup helpers from getting installed
diff --git a/ipatests/setup.py b/ipatests/setup.py
index 32a5207..ba7a40f 100644
--- a/ipatests/setup.py
+++ b/ipatests/setup.py
@@ -56,5 +56,28 @@
             'ipatests.test_pkcs10': ['*.csr'],
             "ipatests.test_ipaserver": ['data/*'],
             'ipatests.test_xmlrpc': ['data/*'],
-        }
+        },
+        install_requires=[
+            "cryptography",
+            "dbus-python",
+            "dnspython",
+            "dogtag-pki",
+            "ipaclient",
+            "ipalib",
+            "ipaplatform",
+            "ipapython",
+            "ipaserver",
+            "lxml",
+            "nose",
+            "pyldap",
+            "pytest",
+            "python-gssapi",
+            "python-nss",
+            "selenium",
+            "six",
+            "yaml",
+        ],
+        setup_requires=[
+            "wheel",
+        ],
     )
-- 
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