[python-chardet] Updated, added python3 subpackage

Miro Hrončok churchyard at fedoraproject.org
Wed Jul 2 15:59:44 UTC 2014


commit 5be0e0171b0838c4ef96e69e07bf009482dd99e0
Author: Miro Hrončok <miro at hroncok.cz>
Date:   Wed Jul 2 17:59:30 2014 +0200

    Updated, added python3 subpackage

 .gitignore          |    1 +
 python-chardet.spec |   83 ++++++++++++++++++++++++++++++++++++--------------
 sources             |    2 +-
 3 files changed, 62 insertions(+), 24 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 493b0ab..f5b65b0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,2 @@
 python2-chardet-2.0.1.tgz
+/chardet-2.2.1.tar.gz
diff --git a/python-chardet.spec b/python-chardet.spec
index 8cfbe48..245b62b 100644
--- a/python-chardet.spec
+++ b/python-chardet.spec
@@ -1,50 +1,87 @@
-%{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
-
-Name:           python-chardet
-Version:        2.0.1
-Release:        8%{?dist}
+%global with_python3 1
+%global pypi_name chardet
+Name:           python-%{pypi_name}
+Version:        2.2.1
+Release:        1%{?dist}
 Summary:        Character encoding auto-detection in Python
 
 Group:          Development/Languages
 License:        LGPLv2
-URL:            http://chardet.feedparser.org
-Source0:        http://chardet.feedparser.org/download/python2-chardet-%{version}.tgz
-BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+URL:            https://github.com/%{pypi_name}/%{pypi_name}
+Source0:        https://pypi.python.org/packages/source/c/%{pypi_name}/%{pypi_name}-%{version}.tar.gz
 
 BuildArch:      noarch
-BuildRequires:  python-devel, python-setuptools
+BuildRequires:  python2-devel, python-setuptools
+
+%if 0%{?with_python3}
+BuildRequires:  python3-devel, python3-setuptools
+%endif # with_python3
 
 %description
 Character encoding auto-detection in Python. As 
 smart as your browser. Open source.
 
-%prep
-%setup -q -n python2-chardet-%{version}
+%if 0%{?with_python3}
+%package -n python3-%{pypi_name}
+Summary:        Character encoding auto-detection in Python 3
 
+%description -n python3-%{pypi_name}
+Character encoding auto-detection in Python. As 
+smart as your browser. Open source.
 
+Python 3 version.
+%endif # with_python3
+
+%prep
+%setup -q -n %{pypi_name}-%{version}
+sed -ie '1d' %{pypi_name}/chardetect.py
+
+%if 0%{?with_python3}
+rm -rf %{py3dir}
+cp -a . %{py3dir}
+%endif # with_python3
 
 %build
-# Remove CFLAGS=... for noarch packages (unneeded)
-%{__python} setup.py build
+%{__python2} setup.py build
+
+%if 0%{?with_python3}
+pushd %{py3dir}
+%{__python3} setup.py build
+popd
+%endif # with_python3
 
 
 %install
-rm -rf $RPM_BUILD_ROOT
-%{__python} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT
-chmod -x COPYING
- 
-%clean
-rm -rf $RPM_BUILD_ROOT
+# Do Python 3 first not to overwrite the entrypoint
+%if 0%{?with_python3}
+pushd %{py3dir}
+%{__python3} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT
+mv $RPM_BUILD_ROOT%{_bindir}/{,python3-}chardetect
+popd
+%endif # with_python3
 
+%{__python2} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT
 
 %files
-%defattr(-,root,root,-)
-%doc COPYING
-# For noarch packages: sitelib
-%{python_sitelib}/*
+%doc README.rst LICENSE
+%{python2_sitelib}/*
+%{_bindir}/chardetect
+
+%if 0%{?with_python3}
+%files -n python3-%{pypi_name}
+%doc README.rst LICENSE
+%{python3_sitelib}/*
+%{_bindir}/python3-chardetect
+%endif # with_python3
 
 
 %changelog
+* Wed Jul 02 2014 Miro Hrončok <mhroncok at redhat.com> - 2.2.1-1
+- Updated to 2.2.1
+- Introduced Python 3 subpackage (upstream has merged the codebase)
+- Removed BuildRoot and python_sitelib definition
+- Use python2 macros instead of just python
+
 * Sat Jun 07 2014 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 2.0.1-8
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
 
diff --git a/sources b/sources
index 6ba688c..e3a852e 100644
--- a/sources
+++ b/sources
@@ -1 +1 @@
-ec771971bab5dd1943a10362ebd2fd4c  python2-chardet-2.0.1.tgz
+4a758402eaefd0331bdedc7ecb6f452c  chardet-2.2.1.tar.gz


More information about the scm-commits mailing list