Hi, Dogtag's Python code has been compatible with Python 3 for a while. So far the code hasn't been packages for Python 3 yet. I've been exploring ways to package the client part of Dogtag's pki package for FreeIPA. The attached patch packages the client libraries from base/common/python/pki as a new python3-pki package.
Christian
From f282036067dda868fc6907b30838e0ed0569e96b Mon Sep 17 00:00:00 2001 From: Christian Heimes <[email protected]> Date: Thu, 21 Jan 2016 13:18:36 +0100 Subject: [PATCH] Package pki client library for Python 3 --- CMakeLists.txt | 26 +++++++++++++++++++- base/common/python/CMakeLists.txt | 15 ++++++++++- base/server/CMakeLists.txt | 6 +++-- specs/pki-core.spec | 52 ++++++++++++++++++++++++++++++++++++--- 4 files changed, 91 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e4fd15e3917b06863a5d8c44c1064eb207c1918a..c74605633f09958532f386e709aaa8dd17a6e701 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -98,10 +98,34 @@ execute_process( ${PYTHON_EXECUTABLE} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()" OUTPUT_VARIABLE - PYTHON_SITE_PACKAGES + PYTHON2_SITE_PACKAGES OUTPUT_STRIP_TRAILING_WHITESPACE ) +# CMake doesn't support multiple PythonInterp +execute_process( + COMMAND + python3 -c + "from distutils.sysconfig import get_python_lib; print(get_python_lib())" + OUTPUT_VARIABLE + PYTHON3_SITE_PACKAGES + ERROR_VARIABLE + PYTHON3_ERROR + RESULT_VARIABLE + PYTHON3_RESULT + OUTPUT_STRIP_TRAILING_WHITESPACE +) + +if(PYTHON3_RESULT) + message(WARNING "python3 not found: ${PYTHON3_RESULT}") + if(PYTHON3_ERROR) + message(WARNING ${PYTHON3_ERROR}) + endif() + unset(PYTHON3_SITE_PACKAGES) +endif() +unset(PYTHON3_RESULT) +unset(PYTHON3_ERROR) + # config.h checks include(ConfigureChecks.cmake) configure_file(config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h) diff --git a/base/common/python/CMakeLists.txt b/base/common/python/CMakeLists.txt index 7c2fad86919a328ab4f507b610ffa26c087da49b..d9d23916d250007b6d880b774bc9a29543d89d34 100644 --- a/base/common/python/CMakeLists.txt +++ b/base/common/python/CMakeLists.txt @@ -37,9 +37,22 @@ install( DIRECTORY pki DESTINATION - ${PYTHON_SITE_PACKAGES} + ${PYTHON2_SITE_PACKAGES} + FILES_MATCHING PATTERN + *.py ) +if(PYTHON3_SITE_PACKAGES) + install( + DIRECTORY + pki + DESTINATION + ${PYTHON3_SITE_PACKAGES} + FILES_MATCHING PATTERN + *.py + ) +endif() + install( DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html diff --git a/base/server/CMakeLists.txt b/base/server/CMakeLists.txt index 058cbf167ea62e0c8a08454b4b43d7a5cc9dc048..d84845c43350e237db5b7c5eecf66f3225a5aa92 100644 --- a/base/server/CMakeLists.txt +++ b/base/server/CMakeLists.txt @@ -32,12 +32,14 @@ install( WORLD_READ ) -# install Python libraries +# install Python libraries (Python 2 only) install( DIRECTORY python/ DESTINATION - ${PYTHON_SITE_PACKAGES} + ${PYTHON2_SITE_PACKAGES} + FILES_MATCHING PATTERN + *.py ) # install systemd scripts diff --git a/specs/pki-core.spec b/specs/pki-core.spec index df2e3aa9e9de7fe8659074eacbd137d20e09197c..32c23d0bd2acd956d05a098ec17ea011881a631c 100644 --- a/specs/pki-core.spec +++ b/specs/pki-core.spec @@ -1,8 +1,12 @@ # Python +%if 0%{?rhel} +%global with_python3 0 +%else +%global with_python3 1 +%endif + %{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")} -%{!?python_sitearch: %global python_sitearch %(%{__python} -c "from -distutils.sysconfig import get_python_lib; print(get_python_lib(1))")} # Tomcat %if 0%{?fedora} >= 23 @@ -129,6 +133,13 @@ BuildRequires: tomcatjss >= 7.1.2 %endif %endif +%if 0%{?with_python3} +BuildRequires: python3-devel +BuildRequires: python3-nss +BuildRequires: python3-requests +BuildRequires: python3-six +%endif # with_python3 +BuildRequires: python-devel # additional build requirements needed to build native 'tpsclient' # REMINDER: Revisit these once 'tpsclient' is rewritten as a Java app @@ -216,6 +227,7 @@ required ONLY by ALL java-based Tomcat Certificate System instances: \ PKI Core also includes the following components: \ \ * pki-javadoc \ + * python3-pki \ \ Finally, if Certificate System is being deployed as an individual or \ set of standalone rather than embedded server(s)/service(s), it is \ @@ -284,8 +296,6 @@ Requires: javassist Requires: jpackage-utils >= 0:1.7.5-10 Requires: jss >= 4.2.6-35 Requires: ldapjdk -Requires: python-ldap -Requires: python-lxml Requires: python-nss Requires: python-requests >= 1.1.0-3 Requires: python-six @@ -326,6 +336,28 @@ This package is a part of the PKI Core used by the Certificate System. %{overview} +%if 0%{?with_python3} + +%package -n python3-pki +Summary: Certificate System - PKI Framework +Group: System Environment/Base + +BuildArch: noarch + +Requires: pki-base = %{version}-%{release} + +Requires: python3-nss +Requires: python3-requests +Requires: python3-six + +%description -n python3-pki +This package contains PKI client library for Python 3. + +This package is a part of the PKI Core used by the Certificate System. + +%{overview} + +%endif # with_python3 for python3-pki %package -n pki-tools Summary: Certificate System - PKI Tools @@ -379,6 +411,9 @@ Obsoletes: pki-silent < %{version}-%{release} Requires: java-headless >= 1:1.7.0 Requires: net-tools +Requires: python-ldap +Requires: python-lxml + %if 0%{?rhel} Requires: nuxwdog-client-java >= 1.0.1-11 %else @@ -853,6 +888,15 @@ systemctl daemon-reload %{_mandir}/man8/pki-upgrade.8.gz %{_mandir}/man1/pki-python-client.1.gz +%if %{with_python3} +%files -n python3-pki +%defattr(-,root,root,-) +%doc base/common/LICENSE +%dir %{python3_sitelib}/pki +%{python3_sitelib}/pki/*.py +%{python3_sitelib}/pki/__pycache__/* +%endif # with_python3 + %files -n pki-tools %defattr(-,root,root,-) %doc base/native-tools/LICENSE base/native-tools/doc/README -- 2.5.0
signature.asc
Description: OpenPGP digital signature
_______________________________________________ Pki-devel mailing list [email protected] https://www.redhat.com/mailman/listinfo/pki-devel
