summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Heimes <cheimes@redhat.com>2016-01-21 13:18:36 +0100
committerChristian Heimes <cheimes@redhat.com>2016-03-04 18:57:00 +0100
commit4dc934a5f3fbeea7e877aaadcb13a6eabb635463 (patch)
tree7c214d07501f21df0a3edc6c68e6fe088d954cee
parent4682e654ecbaef21879bb65db9e939089fda0b72 (diff)
downloadpki-4dc934a5f3fbeea7e877aaadcb13a6eabb635463.tar.gz
pki-4dc934a5f3fbeea7e877aaadcb13a6eabb635463.tar.xz
pki-4dc934a5f3fbeea7e877aaadcb13a6eabb635463.zip
Package pki client library for Python 3
Dogtag's Python code has been compatible with Python 3 for a while. A new package pki-base-python3 provides the pki package for clients. As of now pki.server is not packages for Python 3. The pki-base package also provides pki-base-python2. https://fedorahosted.org/pki/ticket/1739
-rw-r--r--CMakeLists.txt26
-rw-r--r--base/common/python/CMakeLists.txt13
-rw-r--r--base/server/CMakeLists.txt4
-rw-r--r--specs/pki-core.spec47
4 files changed, 86 insertions, 4 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e4fd15e39..c74605633 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 f6e57b949..1aa82e20e 100644
--- a/base/common/python/CMakeLists.txt
+++ b/base/common/python/CMakeLists.txt
@@ -43,11 +43,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 9e986a045..5a6aea96a 100644
--- a/base/server/CMakeLists.txt
+++ b/base/server/CMakeLists.txt
@@ -32,12 +32,12 @@ install(
WORLD_READ
)
-# install Python libraries
+# install Python libraries (Python 2 only)
install(
DIRECTORY
python/pki/server
DESTINATION
- ${PYTHON_SITE_PACKAGES}/pki
+ ${PYTHON2_SITE_PACKAGES}/pki
FILES_MATCHING PATTERN
*.py
)
diff --git a/specs/pki-core.spec b/specs/pki-core.spec
index c69800ce5..7aa77f5f6 100644
--- a/specs/pki-core.spec
+++ b/specs/pki-core.spec
@@ -2,6 +2,11 @@
%{!?__python2: %global __python2 /usr/bin/python2}
%{!?python2_sitelib: %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
+%if 0%{?rhel}
+%global with_python3 0
+%else
+%global with_python3 1
+%endif
# Tomcat
%if 0%{?fedora} >= 23
@@ -129,6 +134,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
@@ -182,6 +194,8 @@ PKI Core contains ALL top-level java-based Tomcat PKI components: \
\
* pki-symkey \
* pki-base \
+ * pki-base-python2 (alias for pki-base) \
+ * pki-base-python3 \
* pki-base-java \
* pki-tools \
* pki-server \
@@ -265,6 +279,7 @@ BuildArch: noarch
Provides: pki-common = %{version}-%{release}
Provides: pki-util = %{version}-%{release}
+Provides: pki-base-python2 = %{version}-%{release}
Obsoletes: pki-common < %{version}-%{release}
Obsoletes: pki-util < %{version}-%{release}
@@ -338,6 +353,28 @@ This package is a part of the PKI Core used by the Certificate System.
%{overview}
+%if 0%{?with_python3}
+
+%package -n pki-base-python3
+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 pki-base-python3
+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
@@ -392,6 +429,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
@@ -890,6 +930,13 @@ systemctl daemon-reload
%{_javadir}/pki/pki-nsutil.jar
%{_javadir}/pki/pki-certsrv.jar
+%if %{with_python3}
+%files -n pki-base-python3
+%defattr(-,root,root,-)
+%doc base/common/LICENSE
+%{python3_sitelib}/pki
+%endif # with_python3
+
%files -n pki-tools
%defattr(-,root,root,-)
%doc base/native-tools/LICENSE base/native-tools/doc/README