diff --git a/brltty.spec b/brltty.spec index 50b5977..c980787 100644 --- a/brltty.spec +++ b/brltty.spec @@ -1,10 +1,18 @@ %define pkg_version 5.6 %define api_version 0.6.7 -%global with_python3 1 - %if 0%{?rhel} && 0%{?rhel} <= 7 -%global with_python3 0 +# disable python3 by default +%bcond_with python3 +%else +%bcond_without python3 +%endif + +%if 0%{?rhel} > 7 || 0%{?fedora} > 28 +# disable python2 by default +%bcond_with python2 +%else +%bcond_without python2 %endif %{!?tcl_version: %global tcl_version %(echo 'puts $tcl_version' | tclsh)} @@ -25,7 +33,7 @@ Name: brltty Version: %{pkg_version} -Release: 6%{?dist} +Release: 7%{?dist} License: LGPLv2+ URL: http://mielke.cc/brltty/ Source0: http://mielke.cc/brltty/archive/%{name}-%{version}.tar.xz @@ -42,7 +50,6 @@ BuildRequires: gettext, at-spi2-core-devel BuildRequires: espeak-devel %endif BuildRequires: espeak-ng-devel -BuildRequires: python2-tools BuildRequires: /usr/bin/2to3 BuildRequires: autoconf @@ -156,6 +163,7 @@ Summary: Tcl binding for BrlAPI %description -n tcl-brlapi This package provides the Tcl binding for BrlAPI. +%if %{with python2} %package -n python2-brlapi %{?python_provide:%python_provide python2-brlapi} Version: %{api_version} @@ -166,15 +174,21 @@ BuildRequires: python2-devel BuildRequires: python2-setuptools Summary: Python binding for BrlAPI %description -n python2-brlapi -This package provides the Python binding for BrlAPI. +This package provides the Python 2 binding for BrlAPI. +%endif -%if 0%{?with_python3} +%if %{with python3} %package -n python3-brlapi +%{?python_provide:%python_provide python3-brlapi} Version: %{api_version} License: LGPLv2+ Requires: brlapi%{?_isa} = %{api_version}-%{release} -BuildRequires: Cython +BuildRequires: python3-Cython BuildRequires: python3-devel +%if %{without python2} +Obsoletes: python2-brlapi < %{api_version}-%{release} +Obsoletes: python-brlapi < %{api_version}-%{release} +%endif Summary: Python 3 binding for BrlAPI %description -n python3-brlapi This package provides the Python 3 binding for BrlAPI. @@ -217,10 +231,10 @@ pushd python2 rm -f Programs/brltty-ktb popd -%if 0%{?with_python3} # Make a copy of the source tree for building the Python 3 module +# Make it all time, we just gonna ignore python2 or python3 when not needed cp -a python2 python3 -%endif + %build # If MAKEFLAGS=-jN is set it would break local builds. @@ -253,6 +267,9 @@ configure_opts=" \ export PYTHONCOERCECLOCALE=0 +PYTHONS= + +%if %{with python2} # First build everything with Python 2 support pushd python2 ./autogen @@ -260,52 +277,60 @@ pushd python2 # Parallel build seems broken, thus disabling it make popd +PYTHONS="$PYTHONS python2" +%endif -%if 0%{?with_python3} +%if %{with python3} # ... and then do it again for the Python 3 module pushd python3 ./autogen -%configure $configure_opts PYTHON=%{__python3} +%configure $configure_opts PYTHON=%{__python3} CYTHON=%{_bindir}/cython3 make popd +PYTHONS="$PYTHONS python3" %endif -pushd python2 -find . -name '*.sgml' | -while read file; do - iconv -f iso8859-1 -t utf-8 $file > $file.conv && mv -f $file.conv $file -done -find . -name '*.txt' | -while read file; do - iconv -f iso8859-1 -t utf-8 $file > $file.conv && mv -f $file.conv $file -done -find . -name 'README*' | -while read file; do - iconv -f iso8859-1 -t utf-8 $file > $file.conv && mv -f $file.conv $file -done -find . \( -path ./doc -o -path ./Documents \) -prune -o \ - \( -name 'README*' -o -name '*.txt' -o -name '*.html' -o \ - -name '*.sgml' -o -name '*.patch' -o \ - \( -path './Bootdisks/*' -type f -perm /ugo=x \) \) -print | -while read file; do - mkdir -p ../doc/${file%/*} && cp -rp $file ../doc/$file || exit 1 +for python in $PYTHONS + do pushd $python + find . -name '*.sgml' | + while read file; do + iconv -f iso8859-1 -t utf-8 $file > $file.conv && mv -f $file.conv $file + done + find . -name '*.txt' | + while read file; do + iconv -f iso8859-1 -t utf-8 $file > $file.conv && mv -f $file.conv $file + done + find . -name 'README*' | + while read file; do + iconv -f iso8859-1 -t utf-8 $file > $file.conv && mv -f $file.conv $file + done + + find . \( -path ./doc -o -path ./Documents \) -prune -o \ + \( -name 'README*' -o -name '*.txt' -o -name '*.html' -o \ + -name '*.sgml' -o -name '*.patch' -o \ + \( -path './Bootdisks/*' -type f -perm /ugo=x \) \) -print | + while read file; do + mkdir -p ../doc/${file%/*} && cp -rp $file ../doc/$file || exit 1 + done + popd done -popd %install %if 0%{?with_ocaml} mkdir -p $RPM_BUILD_ROOT%{_libdir}/ocaml/stublibs %endif +%if %{with python2} # Python 2 pushd python2 make install JAVA_JAR_DIR=%{_jnidir} \ JAVA_JNI_DIR=%{_libdir}/brltty \ JAVA_JNI=yes popd +%endif -%if 0%{?with_python3} +%if %{with python3} # Python 3 pushd python3 make install JAVA_JAR_DIR=%{_jnidir} \ @@ -314,7 +339,13 @@ make install JAVA_JAR_DIR=%{_jnidir} \ popd %endif +%if %{with python3} +# just use the higher number here +pushd python3 +%else pushd python2 +%endif + install -d -m 755 "${RPM_BUILD_ROOT}%{_sysconfdir}" "$RPM_BUILD_ROOT%{_mandir}/man5" install -m 644 Documents/brltty.conf "${RPM_BUILD_ROOT}%{_sysconfdir}" echo ".so man1/brltty.1" > $RPM_BUILD_ROOT%{_mandir}/man5/brltty.conf.5 @@ -453,11 +484,13 @@ fi %files -n tcl-brlapi %{tcl_sitearch}/brlapi-%{api_version} +%if %{with python2} %files -n python2-brlapi %{python2_sitearch}/brlapi.so %{python2_sitearch}/Brlapi-%{api_version}-*.egg-info +%endif -%if 0%{?with_python3} +%if %{with python3} %files -n python3-brlapi %{python3_sitearch}/brlapi.cpython-*.so %{python3_sitearch}/Brlapi-%{api_version}-*.egg-info @@ -474,6 +507,10 @@ fi %endif %changelog +* Fri Mar 16 2018 Miro Hrončok - 5.6-7 +- Don't build Python 2 subpackage on EL > 7 and Fedora > 28 +- Use bconditionals + * Thu Mar 08 2018 Ondřej Lysoněk - 5.6-6 - Build with espeak support only on Fedora