Provide python2- and python3- subpackages (rhbz#1313786).

- Move python examples to -doc subpackage.
This commit is contained in:
Thomas Moschny 2016-07-04 01:30:02 +02:00
parent e95f726d0b
commit e5b29be542
3 changed files with 118 additions and 21 deletions

View File

@ -0,0 +1,9 @@
diff -up Botan-1.10.13/src/wrap/python/__init__.py.orig Botan-1.10.13/src/wrap/python/__init__.py
--- Botan-1.10.13/src/wrap/python/__init__.py.orig 2016-04-28 15:27:08.000000000 +0200
+++ Botan-1.10.13/src/wrap/python/__init__.py 2016-06-30 18:02:11.724997966 +0200
@@ -1,4 +1,4 @@
-from _botan import *
+from botan._botan import *
# Initialize the library when the module is imported
init = LibraryInitializer()

20
botan-boost_python.patch Normal file
View File

@ -0,0 +1,20 @@
diff -up Botan-1.10.13/src/build-data/makefile/python.in.orig Botan-1.10.13/src/build-data/makefile/python.in
--- Botan-1.10.13/src/build-data/makefile/python.in.orig 2016-04-28 15:27:08.000000000 +0200
+++ Botan-1.10.13/src/build-data/makefile/python.in 2016-06-30 16:12:04.001859858 +0200
@@ -15,13 +15,15 @@ BOTAN_PYTHON_MODDIR = %{python_obj_dir}
PYTHON_OBJS = %{python_objs}
+BOOST_PYTHON = boost_python
+
all: $(BOTAN_PYTHON_MODDIR)/_botan.so
%{python_build_cmds}
$(BOTAN_PYTHON_MODDIR)/_botan.so: $(PYTHON_OBJS)
cp %{python_dir}/*.py $(BOTAN_PYTHON_MODDIR)
- $(CXX) -shared -Wl,-soname,$@ $(PYTHON_OBJS) -L. -L$(PYTHON_ROOT) $(LDFLAGS) -lbotan-$(SERIES) -lboost_python -o $@
+ $(CXX) -shared -Wl,-soname,$@ $(PYTHON_OBJS) -L. -L$(PYTHON_ROOT) $(LDFLAGS) -lbotan-$(SERIES) -l$(BOOST_PYTHON) -o $@
clean:
rm -rf $(BOTAN_PYTHON_MODDIR)/*

View File

@ -1,8 +1,12 @@
%global major_version 1.10
%if 0%{?fedora}
%global with_python3 1
%endif
Name: botan
Version: %{major_version}.13
Release: 1%{?dist}
Release: 2%{?dist}
Summary: Crypto library written in C++
Group: System Environment/Libraries
@ -16,19 +20,31 @@ Patch0: botan-aarch64.patch
Patch1: botan-1.10-add-ppc64le.patch
# Enable only cleared ECC algorithms
Patch2: botan-1.10.5-ecc-fix.patch
# Make boost_python selectable
Patch3: botan-boost_python.patch
# Fix wrong path
Patch4: botan-1.10.13-python-init.patch
BuildRequires: gcc-c++
BuildRequires: python
BuildRequires: python-sphinx
BuildRequires: python-devel
BuildRequires: python2
BuildRequires: python2-devel
BuildRequires: boost-python-devel
%if 0%{?with_python3}
BuildRequires: python3
BuildRequires: python3-devel
BuildRequires: boost-python3-devel
%endif # with_python3
BuildRequires: python-sphinx
BuildRequires: bzip2-devel
BuildRequires: zlib-devel
BuildRequires: openssl-devel
# do not check .so files in the python_sitelib directory
%global __provides_exclude_from ^(%{python_sitearch}/.*\\.so)$
# do not check .so files in the python_sitelib directories
%global __provides_exclude_from ^(%{python2_sitearch}/.*\\.so)$
%if 0%{?with_python3}
%global __provides_exclude_from ^(%{python3_sitearch}/.*\\.so)$
%endif # with_python3
%{!?_pkgdocdir: %global _pkgdocdir %{_docdir}/%{name}-%{version}}
@ -66,24 +82,45 @@ BuildArch: noarch
This package contains HTML documentation for %{name}.
%package python
Summary: Python bindings for %{name}
%package -n python2-%{name}
Summary: Python2 bindings for %{name}
Group: System Environment/Libraries
%{?python_provide:%python_provide python2-%{name}}
# the python2 package was named botan-python up to 1.10.13-1
Provides: %{name}-python = %{version}-%{release}
Obsoletes: %{name}-python < 1.10.13-2
%description python
%description -n python2-%{name}
%{summary}
This package contains the Python binding for %{name}.
This package contains the Python2 binding for %{name}.
Note: The Python binding should be considered alpha software, and the
interfaces may change in the future.
%if 0%{?with_python3}
%package -n python3-%{name}
Summary: Python3 bindings for %{name}
Group: System Environment/Libraries
%{?python_provide:%python_provide python2-%{name}}
%description -n python3-%{name}
%{summary}
This package contains the Python3 binding for %{name}.
Note: The Python binding should be considered alpha software, and the
interfaces may change in the future.
%endif # with_python3
%prep
%setup -q -n Botan-%{version}
%patch0 -p1
%patch1 -p1
%patch2 -p1 -b .eccfix
%patch3 -p1
%patch4 -p1
# These tests will fail.
rm -rf checks/ec_tests.cpp
@ -104,14 +141,30 @@ rm -rf checks/ec_tests.cpp
--enable-modules=%{enable_modules} \
--disable-modules=%{disable_modules} \
--with-boost-python \
--with-python-version=%{python_version} \
--with-python-version=dummy.dummy \
--with-sphinx
%if 0%{?with_python3}
cp -a build/python{,3}
%endif # with_python3
# (ab)using CXX as an easy way to inject our CXXFLAGS
make CXX="g++ ${CXXFLAGS:-%{optflags}}" %{?_smp_mflags}
make -f Makefile.python \
CXX="g++ ${CXXFLAGS:-%{optflags}}" %{?_smp_mflags}
make -f Makefile.python \
CXX="g++ ${CXXFLAGS:-%{optflags}}" %{?_smp_mflags} \
PYTHON_INC="$(python2-config --includes)" \
PYTHON_ROOT=.
%if 0%{?with_python3}
mv build/python{,2} ; mv build/python{3,}
make -f Makefile.python \
CXX="g++ ${CXXFLAGS:-%{optflags}}" %{?_smp_mflags} \
PYTHON_INC="$(python3-config --includes)" \
PYTHON_ROOT=. \
BOOST_PYTHON=boost_python3
mv build/python{,3} ; mv build/python{2,}
%endif # with_python3
%install
make install \
@ -121,12 +174,19 @@ make install \
INSTALL_CMD_DATA="install -p -m 644"
make -f Makefile.python install \
PYTHON_SITE_PACKAGE_DIR=%{buildroot}%{python_sitearch}
PYTHON_SITE_PACKAGE_DIR=%{buildroot}%{python2_sitearch}
%if 0%{?with_python3}
mv build/python{,2} ; mv build/python{3,}
make -f Makefile.python install \
PYTHON_SITE_PACKAGE_DIR=%{buildroot}%{python3_sitearch}
mv build/python{,3} ; mv build/python{2,}
%endif # with_python3
# fixups
find doc/examples -type f -exec chmod -x {} \;
mv doc/examples/python doc/python-examples
cp -a doc/{examples,python-examples,license.txt} \
mv doc/examples/python doc/python2-examples
cp -a doc/{examples,python2-examples,license.txt} \
%{buildroot}%{_pkgdocdir}
cp -a %{SOURCE1} %{buildroot}%{_pkgdocdir}
rm -r %{buildroot}%{_pkgdocdir}/manual/{.doctrees,.buildinfo}
@ -173,13 +233,17 @@ rm -r %{buildroot}%{_pkgdocdir}/manual/{.doctrees,.buildinfo}
%else
%{_pkgdocdir}/license.txt
%endif # licensedir
%{_pkgdocdir}/python2-examples
%files python
%{_pkgdocdir}/python-examples
%exclude %{_pkgdocdir}/python-examples/*.pyc
%exclude %{_pkgdocdir}/python-examples/*.pyo
%{python_sitearch}/%{name}
%files -n python2-%{name}
%{python2_sitearch}/%{name}
%if 0%{?with_python3}
%files -n python3-%{name}
%{python3_sitearch}/%{name}
%endif # with_python3
%check
@ -193,6 +257,10 @@ LD_LIBRARY_PATH=%{buildroot}%{_libdir} ./check --validate
%changelog
* Sun Jul 3 2016 Thomas Moschny <thomas.moschny@gmx.de> - 1.10.13-2
- Provide python2- and python3- subpackages (rhbz#1313786).
- Move python examples to -doc subpackage.
* Fri Apr 29 2016 Thomas Moschny <thomas.moschny@gmx.de> - 1.10.13-1
- Update to 1.10.13.