From f14c43a2e72cdef38feea37da6a40c5dd65f3759 Mon Sep 17 00:00:00 2001 From: Mike FABIAN Date: Wed, 19 Jun 2019 09:23:17 +0200 Subject: [PATCH 1/2] Add python_provide macro to make the switch from Python 2 to Python3 automatic (Resolves: rhbz#1717341) --- langtable.spec | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/langtable.spec b/langtable.spec index 84fb027..c8d0a07 100644 --- a/langtable.spec +++ b/langtable.spec @@ -1,6 +1,6 @@ Name: langtable Version: 0.0.43 -Release: 1%{?dist} +Release: 2%{?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 @@ -25,6 +25,7 @@ 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} @@ -79,6 +80,10 @@ xmllint --noout --relaxng $RPM_BUILD_ROOT/%{_datadir}/langtable/schemas/timezone %{_datadir}/langtable/*.xml.gz %changelog +* 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 From bb6d19a1bbfe3779fe1d9dbb83494e41bc96bbbd Mon Sep 17 00:00:00 2001 From: Mike FABIAN Date: Sun, 14 Jul 2019 16:40:18 +0200 Subject: [PATCH 2/2] Add back python2-langtable subpackage, was removed too late for Fedora 30 Resolves: rhbz#1724767 --- langtable.spec | 45 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) diff --git a/langtable.spec b/langtable.spec index c8d0a07..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: 2%{?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,6 +27,22 @@ 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+ @@ -49,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 @@ -70,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 @@ -80,6 +119,10 @@ 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