summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Heimes <cheimes@redhat.com>2016-03-02 19:24:28 +0100
committerChristian Heimes <cheimes@redhat.com>2016-03-03 21:44:23 +0100
commit0e35b64c1f751cc8a7a8a0fac25828a8eab24714 (patch)
treeef68de896af93b309f32615d8e2a63490f56a805
parentce049a83d78c30d0664c5d337766b222ef89202b (diff)
downloadpki-0e35b64c1f751cc8a7a8a0fac25828a8eab24714.tar.gz
pki-0e35b64c1f751cc8a7a8a0fac25828a8eab24714.tar.xz
pki-0e35b64c1f751cc8a7a8a0fac25828a8eab24714.zip
Simplify Python package installation
* The cmake files now copy just *.py into the installation directory. This ensures that no stale pyc files or __pycache__ directories are copied. rpmbuilder takes care of pyc/pyo compilation on Fedora and RHEL. * The pki-core.spec file uses python2 macros. In case of RHEL missing macros are defined on the top of the file. * A bug in the python_sitelib macros has been fixed. rpmbuilder doesn't like lines breaks.
-rw-r--r--base/common/python/CMakeLists.txt2
-rw-r--r--base/server/CMakeLists.txt6
-rw-r--r--specs/pki-core.spec24
3 files changed, 14 insertions, 18 deletions
diff --git a/base/common/python/CMakeLists.txt b/base/common/python/CMakeLists.txt
index a16459775..f6e57b949 100644
--- a/base/common/python/CMakeLists.txt
+++ b/base/common/python/CMakeLists.txt
@@ -44,6 +44,8 @@ install(
pki
DESTINATION
${PYTHON_SITE_PACKAGES}
+ FILES_MATCHING PATTERN
+ *.py
)
install(
diff --git a/base/server/CMakeLists.txt b/base/server/CMakeLists.txt
index 058cbf167..c4c6baacf 100644
--- a/base/server/CMakeLists.txt
+++ b/base/server/CMakeLists.txt
@@ -35,9 +35,11 @@ install(
# install Python libraries
install(
DIRECTORY
- python/
+ python/pki/server
DESTINATION
- ${PYTHON_SITE_PACKAGES}
+ ${PYTHON_SITE_PACKAGES}/pki/server
+ FILES_MATCHING PATTERN
+ *.py
)
# install systemd scripts
diff --git a/specs/pki-core.spec b/specs/pki-core.spec
index 76fce56e9..c69800ce5 100644
--- a/specs/pki-core.spec
+++ b/specs/pki-core.spec
@@ -1,8 +1,7 @@
-# Python
-%{!?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))")}
+# Python, keep every statement on a single line
+%{!?__python2: %global __python2 /usr/bin/python2}
+%{!?python2_sitelib: %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
+
# Tomcat
%if 0%{?fedora} >= 23
@@ -737,13 +736,13 @@ ln -s %{_datadir}/pki/java-tools/KRATool.cfg %{buildroot}%{_datadir}/pki/java-to
%if ! 0%{?rhel}
# Scanning the python code with pylint.
-python2 ../pylint-build-scan.py rpm --prefix %{buildroot}
+%{__python2} ../pylint-build-scan.py rpm --prefix %{buildroot}
if [ $? -ne 0 ]; then
echo "pylint failed. RC: $?"
exit 1
fi
-python2 ../pylint-build-scan.py rpm --prefix %{buildroot} -- --py3k
+%{__python2} ../pylint-build-scan.py rpm --prefix %{buildroot} -- --py3k
if [ $? -ne 0 ]; then
echo "pylint --py3k failed. RC: $?"
exit 1
@@ -879,14 +878,7 @@ systemctl daemon-reload
%{_datadir}/pki/key/templates
%dir %{_sysconfdir}/pki
%config(noreplace) %{_sysconfdir}/pki/pki.conf
-%dir %{python_sitelib}/pki
-%{python_sitelib}/pki/*.py
-%{python_sitelib}/pki/*.pyc
-%{python_sitelib}/pki/*.pyo
-%dir %{python_sitelib}/pki/cli
-%{python_sitelib}/pki/cli/*.py
-%{python_sitelib}/pki/cli/*.pyc
-%{python_sitelib}/pki/cli/*.pyo
+%{python2_sitelib}/pki
%dir %{_localstatedir}/log/pki
%{_sbindir}/pki-upgrade
%{_mandir}/man8/pki-upgrade.8.gz
@@ -958,7 +950,7 @@ systemctl daemon-reload
%{_sbindir}/pki-server
%{_sbindir}/pki-server-nuxwdog
%{_sbindir}/pki-server-upgrade
-%{python_sitelib}/pki/server/
+%{python2_sitelib}/pki/server/
%dir %{_datadir}/pki/deployment
%{_datadir}/pki/deployment/config/
%dir %{_datadir}/pki/scripts