diff --git a/langtable.spec b/langtable.spec index 84fb027..a2c9c19 100644 --- a/langtable.spec +++ b/langtable.spec @@ -1,6 +1,10 @@ +%if 0%{?fedora} < 31 +%global with_python2 1 +%endif + Name: langtable Version: 0.0.43 -Release: 1%{?dist} +Release: 3%{?dist} Summary: Guessing reasonable defaults for locale, keyboard layout, territory, and language. # the translations in languages.xml and territories.xml are (mostly) # imported from CLDR and are thus under the Unicode license, the @@ -11,6 +15,9 @@ URL: https://github.com/mike-fabian/langtable Source0: https://github.com/mike-fabian/langtable/releases/download/%{version}/%{name}-%{version}.tar.gz BuildArch: noarch BuildRequires: perl-interpreter +%if 0%{?with_python2} +BuildRequires: python2-devel +%endif BuildRequires: python3-devel %description @@ -20,11 +27,28 @@ example, guess the territory and the keyboard layout if the language is known or guess the language and keyboard layout if the territory is already known. +%if 0%{?with_python2} +%package -n python2-langtable +%{?python_provide:%python_provide python2-langtable} +# Remove before F30 +Provides: %{name}-python%{?_isa} = %{version}-%{release} +Obsoletes: %{name}-python < %{version}-%{release} +Summary: Python module to query the langtable-data +License: GPLv3+ +Requires: %{name} = %{version}-%{release} +Requires: %{name}-data = %{version}-%{release} + +%description -n python2-langtable +This package contains a Python module to query the data +from langtable-data. +%endif + %package -n python3-langtable Summary: Python module to query the langtable-data License: GPLv3+ Requires: %{name} = %{version}-%{release} Requires: %{name}-data = %{version}-%{release} +%{?python_provide:%python_provide python3-%{name}} # Remove before F30 Provides: %{name}-python3 = %{version}-%{release} Provides: %{name}-python3%{?_isa} = %{version}-%{release} @@ -48,14 +72,25 @@ This package contains the data files for langtable. %build perl -pi -e "s,_datadir = '(.*)',_datadir = '%{_datadir}/langtable'," langtable.py +%if 0%{?with_python2} +%py2_build +%endif + %py3_build %install +%if 0%{?with_python2} +%py2_install -- --install-data=%{_datadir}/langtable +gzip --force --best $RPM_BUILD_ROOT/%{_datadir}/langtable/*.xml +%endif %py3_install -- --install-data=%{_datadir}/langtable gzip --force --best $RPM_BUILD_ROOT/%{_datadir}/langtable/*.xml %check +%if 0%{?with_python2} +(cd $RPM_BUILD_DIR/%{name}-%{version}/data; PYTHONPATH=.. %{__python2} ../test_cases.py; %{__python2} ../langtable.py) +%endif (cd $RPM_BUILD_DIR/%{name}-%{version}/data; PYTHONPATH=.. %{__python3} ../test_cases.py; %{__python3} ../langtable.py) xmllint --noout --relaxng $RPM_BUILD_ROOT/%{_datadir}/langtable/schemas/keyboards.rng $RPM_BUILD_ROOT/%{_datadir}/langtable/keyboards.xml.gz xmllint --noout --relaxng $RPM_BUILD_ROOT/%{_datadir}/langtable/schemas/languages.rng $RPM_BUILD_ROOT/%{_datadir}/langtable/languages.xml.gz @@ -69,6 +104,11 @@ xmllint --noout --relaxng $RPM_BUILD_ROOT/%{_datadir}/langtable/schemas/timezone %dir %{_datadir}/langtable/ %{_datadir}/langtable/schemas +%if 0%{?with_python2} +%files -n python2-langtable +%{python2_sitelib}/* +%endif + %files -n python3-langtable %{python3_sitelib}/langtable.py %{python3_sitelib}/langtable-*.egg-info @@ -79,6 +119,14 @@ xmllint --noout --relaxng $RPM_BUILD_ROOT/%{_datadir}/langtable/schemas/timezone %{_datadir}/langtable/*.xml.gz %changelog +* Sun Jul 14 2019 Mike FABIAN - 0.0.43-3 +- Add back python2-langtable subpackage, was removed too late for Fedora 30 +- Resolves: rhbz#1724767 + +* Wed Jun 19 2019 Mike FABIAN - 0.0.43-2 +- Add python_provide macro to make the switch from Python 2 to Python3 automatic +- Resolves: rhbz#1717341 + * Fri May 10 2019 Mike FABIAN - 0.0.43-1 - Get translation changes from CLDR - Add some new translations from CLDR