+#
# Conditional build:
-%bcond_without python2 # build python 2 module
-%bcond_without python3 # build python 3 module
+%bcond_without python2 # build CPython 2.x module
+%bcond_without python3 # build CPython 3.x module
#
%define module charade
-Summary: The Universal character encoding detector
+Summary: Charade - The Universal character encoding detector for Python
+Summary(pl.UTF-8): Charade - uniwersalny moduł Pythona wykrywający kodowanie znaków
Name: python-%{module}
Version: 1.0.3
Release: 1
BuildRequires: python-modules >= 1:2.6
%endif
%if %{with python3}
-BuildRequires: python3-modules
+BuildRequires: python3-modules >= 1:3.2
%endif
BuildRequires: rpm-pythonprov
BuildRequires: rpmbuild(macros) >= 1.219
%description
Charade: The Universal character encoding detector. This is a port of
-Mark Pilgrim's excellent chardet. Previous two versions needed to be
-maintained: one that supported python 2.x and one that supported
-python 3.x. With the minor amount of work placed into this port,
-charade now supports both in one codebase. The base for the work was
-Mark's last available copy of the chardet source for python 3000.
+Mark Pilgrim's excellent chardet, modified to share codebase for both
+Python 2.x and 3.x.
+
+This package contains module built for Python 2.x.
+
+%description -l pl.UTF-8
+Moduł Pythona Charade służy do automatycznego wykrywania kodowania
+znaków. Jest to port znakomitego modułu chardet Marka Pilgrima,
+zmodyfikowany pod kątem współdzielenia kodu między wersjami Pythona
+2.x oraz 3.x.
+
+Ten pakiet zawiera moduł zbudowany dla Pythona 2.x.
%package -n python3-charade
-Summary: The Universal character encoding detector
+Summary: Charade - The Universal character encoding detector
+Summary(pl.UTF-8): Charade - uniwersalny moduł Pythona wykrywający kodowanie znaków
Group: Development/Languages/Python
-Requires: python3-modules
+Requires: python3-modules >= 1:3.2
%description -n python3-charade
Charade: The Universal character encoding detector. This is a port of
-Mark Pilgrim's excellent chardet. Previous two versions needed to be
-maintained: one that supported python 2.x and one that supported
-python 3.x. With the minor amount of work placed into this port,
-charade now supports both in one codebase. The base for the work was
-Mark's last available copy of the chardet source for python 3000.
+Mark Pilgrim's excellent chardet, modified to share codebase for both
+Python 2.x and 3.x.
+
+This package contains module built for Python 3.x.
+
+%description -n python3-charade -l pl.UTF-8
+Moduł Pythona Charade służy do automatycznego wykrywania kodowania
+znaków. Jest to port znakomitego modułu chardet Marka Pilgrima,
+zmodyfikowany pod kątem współdzielenia kodu między wersjami Pythona
+2.x oraz 3.x.
+
+Ten pakiet zawiera moduł zbudowany dla Pythona 3.x.
%prep
%setup -q -n %{module}-%{version}
%install
rm -rf $RPM_BUILD_ROOT
-%if %{with python2}
-%{__python} setup.py \
- build -b py2 \
+%if %{with python3}
+%{__python3} setup.py \
+ build -b py3 \
install \
--skip-build \
--optimize=2 \
--root=$RPM_BUILD_ROOT
-%py_ocomp $RPM_BUILD_ROOT%{py_sitescriptdir}
-%py_comp $RPM_BUILD_ROOT%{py_sitescriptdir}
-%py_postclean
+
+%{__mv} $RPM_BUILD_ROOT%{_bindir}/charade{,3}
%endif
-%if %{with python3}
-%{__python3} setup.py \
- build -b py3 \
+%if %{with python2}
+%{__python} setup.py \
+ build -b py2 \
install \
--skip-build \
--optimize=2 \
--root=$RPM_BUILD_ROOT
+%py_ocomp $RPM_BUILD_ROOT%{py_sitescriptdir}
+%py_comp $RPM_BUILD_ROOT%{py_sitescriptdir}
+%py_postclean
%endif
%clean
%files
%defattr(644,root,root,755)
%doc HISTORY.rst README.rst
+%attr(755,root,root) %{_bindir}/charade
%{py_sitescriptdir}/%{module}
-%if "%{py_ver}" > "2.4"
%{py_sitescriptdir}/%{module}-%{version}-py*.egg-info
%endif
-%endif
%if %{with python3}
%files -n python3-charade
%defattr(644,root,root,755)
%doc HISTORY.rst README.rst
+%attr(755,root,root) %{_bindir}/charade3
%{py3_sitescriptdir}/%{module}
%{py3_sitescriptdir}/%{module}-%{version}-py*.egg-info
%endif