[brltty] Add Python 3 support (python3-brlapi)

Kalev Lember kalev at fedoraproject.org
Thu Apr 4 14:06:48 UTC 2013


commit 24e84ce2e3e68196494fa708cce00f7d877a7315
Author: Kalev Lember <kalevlember at gmail.com>
Date:   Thu Apr 4 16:02:15 2013 +0200

    Add Python 3 support (python3-brlapi)

 brltty.spec |   43 +++++++++++++++++++++++++++++++++++++++----
 1 files changed, 39 insertions(+), 4 deletions(-)
---
diff --git a/brltty.spec b/brltty.spec
index edfb382..3451253 100644
--- a/brltty.spec
+++ b/brltty.spec
@@ -116,6 +116,17 @@ Summary: Python binding for BrlAPI
 %description -n python-brlapi
 This package provides the Python binding for BrlAPI.
 
+%package -n python3-brlapi
+Version: %{api_version}
+Group: Development/System
+License: LGPLv2+
+Requires: brlapi = %{api_version}-%{release}
+BuildRequires: Cython
+BuildRequires: python3-devel
+Summary: Python 3 binding for BrlAPI
+%description -n python3-brlapi
+This package provides the Python 3 binding for BrlAPI.
+
 %package -n brlapi-java
 Version: %{api_version}
 Group: Development/System
@@ -146,6 +157,10 @@ This package provides the OCaml binding for BrlAPI.
 %setup -q
 %patch4 -p1 -b .loadLibrary
 
+# Make a copy of the source tree for building the Python 3 module
+rm -rf %{py3dir}
+cp -a . %{py3dir}
+
 %build
 # Add the openjdk include directories to CPPFLAGS
 for i in -I/usr/lib/jvm/java/include{,/linux}; do
@@ -158,19 +173,26 @@ export CXXFLAGS="%{optflags} -fno-strict-aliasing"
 
 # there is no curses packages in BuildRequires, so the package builds
 # without them in mock; let's express this decision explicitly
-%configure \
+configure_opts=" \
   --disable-stripping \
   --without-curses \
 %if %{with_speech_dispatcher}
   --with-speechd=%{_prefix} \
 %endif
-  --with-install-root="${RPM_BUILD_ROOT}"
+  --with-install-root=$RPM_BUILD_ROOT
   JAVA_JAR_DIR=%{_jnidir} \
   JAVA_JNI_DIR=%{_libdir}/brltty \
-  JAVA_JNI=yes
+  JAVA_JNI=yes"
 
+# First build everything with Python 2 support
+%configure $configure_opts PYTHON=%{__python2}
+make %{?_smp_mflags}
 
+# ... and then do it again for the Python 3 module
+pushd %{py3dir}
+%configure $configure_opts PYTHON=%{__python3}
 make %{?_smp_mflags}
+popd
 
 find . \( -path ./doc -o -path ./Documents \) -prune -o \
   \( -name 'README*' -o -name '*.txt' -o -name '*.html' -o \
@@ -194,10 +216,18 @@ while read file; do
 done
 
 %install
-# does not seem to be parallel safe
+# Python 2
 make install JAVA_JAR_DIR=%{_jnidir} \
              JAVA_JNI_DIR=%{_libdir}/brltty \
              JAVA_JNI=yes
+
+# Python 3
+pushd %{py3dir}
+make install JAVA_JAR_DIR=%{_jnidir} \
+             JAVA_JNI_DIR=%{_libdir}/brltty \
+             JAVA_JNI=yes
+popd
+
 rm "$RPM_BUILD_ROOT%{_libdir}/libbrlapi.so"
 ln -s ../../%{_lib}/libbrlapi.so.0.5 "$RPM_BUILD_ROOT%{_prefix}/%{_lib}/libbrlapi.so"
 install -d -m 755 "${RPM_BUILD_ROOT}%{_sysconfdir}" "$RPM_BUILD_ROOT%{_mandir}/man5"
@@ -291,6 +321,10 @@ exit 0
 %{python_sitearch}/brlapi.so
 %{python_sitearch}/Brlapi-%{api_version}-*.egg-info
 
+%files -n python3-brlapi
+%{python3_sitearch}/brlapi.cpython-*.so
+%{python3_sitearch}/Brlapi-%{api_version}-*.egg-info
+
 %files -n brlapi-java
 %{_libdir}/brltty/libbrlapi_java.so
 %{_jnidir}/brlapi.jar
@@ -304,6 +338,7 @@ exit 0
 %changelog
 * Thu Apr 04 2013 Kalev Lember <kalevlember at gmail.com> - 4.5-1
 - Update to 4.5
+- Add Python 3 support (python3-brlapi)
 
 * Wed Feb 13 2013 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 4.3-13
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild


More information about the scm-commits mailing list