[packages/librepo] fix python install dir and sphinx-build

jajcus jajcus at pld-linux.org
Mon Nov 30 18:52:25 CET 2015


commit 3a50a18e70db8189229c4450dd16131f8ba76b30
Author: Jacek Konieczny <jajcus at jajcus.net>
Date:   Mon Nov 30 18:51:26 2015 +0100

    fix python install dir and sphinx-build
    
    Release: 5

 librepo.spec             | 72 +++++++++++++++++++++++++++++++++++++++++++++---
 python-install-dir.patch | 21 ++++++++++++++
 sphinx_executable.patch  | 10 +++++++
 3 files changed, 99 insertions(+), 4 deletions(-)
---
diff --git a/librepo.spec b/librepo.spec
index 9935380..0e45ee6 100644
--- a/librepo.spec
+++ b/librepo.spec
@@ -1,18 +1,22 @@
 #
 # Conditional build:
 %bcond_without	apidocs		# do not build and package API docs
+%bcond_without	python2 # CPython 2.x module
+%bcond_without	python3 # CPython 3.x module
 
 Summary:	Library for downloading Linux repository metadata and packages
 Summary(pl.UTF-8):	Biblioteka do pobierania metadanych repozytoriów roaz pakietów dla Linuksa
 Name:		librepo
 Version:	1.7.13
-Release:	4
+Release:	5
 License:	GPL v2+
 Group:		Libraries
 Source0:	https://github.com/Tojaj/librepo/archive/%{name}-%{version}.tar.gz
 # Source0-md5:	e71590f07a38b10c0dfbf857d828b71c
 #Source0:	http://pkgs.fedoraproject.org/repo/pkgs/librepo/%{name}-%{gitrev}.tar.xz/904628ef27b512e7aed07a6d41613c87/librepo-%{gitrev}.tar.xz
 Patch0:		%{name}-link.patch
+Patch1:		python-install-dir.patch
+Patch2:		sphinx_executable.patch
 URL:		http://tojaj.github.io/librepo/
 BuildRequires:	attr-devel
 BuildRequires:	check-devel
@@ -23,9 +27,15 @@ BuildRequires:	expat-devel >= 1.95
 BuildRequires:	glib2-devel >= 2.0
 BuildRequires:	gpgme-devel
 BuildRequires:	openssl-devel
-BuildRequires:	python-devel >= 2
 BuildRequires:	rpmbuild(macros) >= 1.605
-%{?with_apidocs:BuildRequires:	sphinx-pdg}
+%if %{with python2}
+BuildRequires:	python-devel >= 1:2
+%{?with_apidocs:BuildRequires:	sphinx-pdg-2}
+%endif
+%if %{with python3}
+BuildRequires:	python3-devel >= 1:3
+%{?with_apidocs:BuildRequires:	sphinx-pdg-3}
+%endif
 BuildRequires:	tar >= 1:1.22
 BuildRequires:	xz
 BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
@@ -78,20 +88,56 @@ Python binding for librepo library.
 %description -n python-librepo -l pl.UTF-8
 Wiązanie Pythona do biblioteki librepo.
 
+%package -n python3-librepo
+Summary:	Python binding for librepo library
+Summary(pl.UTF-8):	Wiązanie Pythona do biblioteki librepo
+Group:		Libraries/Python
+Requires:	%{name} = %{version}-%{release}
+
+%description -n python3-librepo
+Python binding for librepo library.
+
+%description -n python3-librepo -l pl.UTF-8
+Wiązanie Pythona do biblioteki librepo.
+
 %prep
 %setup -q -n %{name}-%{name}-%{version}
 %patch0 -p1
+%patch1 -p1
+%patch2 -p1
 
 %build
 install -d build
 cd build
-%cmake ..
+%cmake .. \
+%if %{with python2}
+	-DPYTHON_DESIRED=2 \
+	-DPYTHON_INSTALL_DIR="%{py_sitedir}" \
+	-DSPHINX_EXECUTABLE=/usr/bin/sphinx-build-2
+%endif
 
 %{__make}
 
 %if %{with apidocs}
 %{__make} doc
 %endif
+cd ..
+
+%if %{with python3}
+install -d build-py3
+cd build-py3
+%cmake .. \
+	-DPYTHON_DESIRED=3 \
+	-DPYTHON_INSTALL_DIR="%{py3_sitedir}" \
+	-DSPHINX_EXECUTABLE=/usr/bin/sphinx-build-3
+
+%{__make}
+
+%if %{with apidocs}
+%{__make} doc
+%endif
+cd ..
+%endif
 
 %install
 rm -rf $RPM_BUILD_ROOT
@@ -99,6 +145,11 @@ rm -rf $RPM_BUILD_ROOT
 %{__make} -C build install \
 	DESTDIR=$RPM_BUILD_ROOT
 
+%if %{with python3}
+%{__make} -C build-py3 install \
+	DESTDIR=$RPM_BUILD_ROOT
+%endif
+
 %py_comp $RPM_BUILD_ROOT%{py_sitedir}/librepo
 %py_ocomp $RPM_BUILD_ROOT%{py_sitedir}/librepo
 %py_postclean
@@ -126,6 +177,7 @@ rm -rf $RPM_BUILD_ROOT
 %doc build/doc/c/html/*
 %endif
 
+%if %{with python2}
 %files -n python-librepo
 %defattr(644,root,root,755)
 %if %{with apidocs}
@@ -134,3 +186,15 @@ rm -rf $RPM_BUILD_ROOT
 %dir %{py_sitedir}/librepo
 %attr(755,root,root) %{py_sitedir}/librepo/_librepomodule.so
 %{py_sitedir}/librepo/__init__.py[co]
+%endif
+
+%if %{with python3}
+%files -n python3-librepo
+%defattr(644,root,root,755)
+%if %{with apidocs}
+%doc build-py3/doc/python/{*.html,_sources,_static}
+%endif
+%dir %{py3_sitedir}/librepo
+%attr(755,root,root) %{py3_sitedir}/librepo/_librepo.so
+%{py3_sitedir}/librepo/__init__.py
+%endif
diff --git a/python-install-dir.patch b/python-install-dir.patch
new file mode 100644
index 0000000..24861ca
--- /dev/null
+++ b/python-install-dir.patch
@@ -0,0 +1,21 @@
+diff -dur -x '*~' librepo-librepo-1.7.13.orig/librepo/python/python2/CMakeLists.txt librepo-librepo-1.7.13/librepo/python/python2/CMakeLists.txt
+--- librepo-librepo-1.7.13.orig/librepo/python/python2/CMakeLists.txt	2015-01-23 15:43:51.000000000 +0100
++++ librepo-librepo-1.7.13/librepo/python/python2/CMakeLists.txt	2015-11-30 18:37:49.354123049 +0100
+@@ -1,6 +1,5 @@
+ FIND_PACKAGE (PythonLibs 2 )
+ FIND_PACKAGE (PythonInterp 2 REQUIRED)
+-EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -c "from sys import stdout; from distutils import sysconfig; stdout.write(sysconfig.get_python_lib(True))" OUTPUT_VARIABLE PYTHON_INSTALL_DIR)
+ INCLUDE_DIRECTORIES (${PYTHON_INCLUDE_PATH})
+ 
+ MESSAGE(STATUS "Python install dir is ${PYTHON_INSTALL_DIR}")
+diff -dur -x '*~' librepo-librepo-1.7.13.orig/librepo/python/python3/CMakeLists.txt librepo-librepo-1.7.13/librepo/python/python3/CMakeLists.txt
+--- librepo-librepo-1.7.13.orig/librepo/python/python3/CMakeLists.txt	2015-01-23 15:43:51.000000000 +0100
++++ librepo-librepo-1.7.13/librepo/python/python3/CMakeLists.txt	2015-11-30 18:37:38.354048339 +0100
+@@ -10,7 +10,6 @@
+ 
+ FIND_PACKAGE(PythonLibs 3.0)
+ FIND_PACKAGE(PythonInterp 3.0 REQUIRED)
+-EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -c "from sys import stdout; from distutils import sysconfig; stdout.write(sysconfig.get_python_lib(True))" OUTPUT_VARIABLE PYTHON_INSTALL_DIR)
+ INCLUDE_DIRECTORIES (${PYTHON_INCLUDE_PATH})
+ 
+ MESSAGE(STATUS "Python3 install dir is ${PYTHON_INSTALL_DIR}")
diff --git a/sphinx_executable.patch b/sphinx_executable.patch
new file mode 100644
index 0000000..803cea3
--- /dev/null
+++ b/sphinx_executable.patch
@@ -0,0 +1,10 @@
+diff -dur librepo-librepo-1.7.13.orig/doc/python/CMakeLists.txt librepo-librepo-1.7.13/doc/python/CMakeLists.txt
+--- librepo-librepo-1.7.13.orig/doc/python/CMakeLists.txt	2015-01-23 15:43:51.000000000 +0100
++++ librepo-librepo-1.7.13/doc/python/CMakeLists.txt	2015-11-30 18:48:12.275656366 +0100
+@@ -1,5 +1,5 @@
+ ADD_CUSTOM_TARGET (doc-python
+-    PYTHONPATH=${CMAKE_BINARY_DIR}/librepo/python/python${PYTHON_DESIRED} sphinx-build -E -b html
++	PYTHONPATH=${CMAKE_BINARY_DIR}/librepo/python/python${PYTHON_DESIRED} ${SPHINX_EXECUTABLE} -E -b html
+                   ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}
+                   COMMENT "Building Python API documentation with Sphinx")
+ 
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/librepo.git/commitdiff/3a50a18e70db8189229c4450dd16131f8ba76b30



More information about the pld-cvs-commit mailing list