Updated, added python3 subpackage

This commit is contained in:
Miro Hrončok 2014-07-02 17:59:30 +02:00
parent c6cc577ae0
commit 5be0e0171b
3 changed files with 62 additions and 24 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
python2-chardet-2.0.1.tgz python2-chardet-2.0.1.tgz
/chardet-2.2.1.tar.gz

View File

@ -1,50 +1,87 @@
%{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} %global with_python3 1
%global pypi_name chardet
Name: python-chardet Name: python-%{pypi_name}
Version: 2.0.1 Version: 2.2.1
Release: 8%{?dist} Release: 1%{?dist}
Summary: Character encoding auto-detection in Python Summary: Character encoding auto-detection in Python
Group: Development/Languages Group: Development/Languages
License: LGPLv2 License: LGPLv2
URL: http://chardet.feedparser.org URL: https://github.com/%{pypi_name}/%{pypi_name}
Source0: http://chardet.feedparser.org/download/python2-chardet-%{version}.tgz Source0: https://pypi.python.org/packages/source/c/%{pypi_name}/%{pypi_name}-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch 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 %description
Character encoding auto-detection in Python. As Character encoding auto-detection in Python. As
smart as your browser. Open source. smart as your browser. Open source.
%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 %prep
%setup -q -n python2-chardet-%{version} %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 %build
# Remove CFLAGS=... for noarch packages (unneeded) %{__python2} setup.py build
%{__python} setup.py build
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py build
popd
%endif # with_python3
%install %install
rm -rf $RPM_BUILD_ROOT # Do Python 3 first not to overwrite the entrypoint
%{__python} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT %if 0%{?with_python3}
chmod -x COPYING pushd %{py3dir}
%{__python3} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT
%clean mv $RPM_BUILD_ROOT%{_bindir}/{,python3-}chardetect
rm -rf $RPM_BUILD_ROOT popd
%endif # with_python3
%{__python2} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT
%files %files
%defattr(-,root,root,-) %doc README.rst LICENSE
%doc COPYING %{python2_sitelib}/*
# For noarch packages: sitelib %{_bindir}/chardetect
%{python_sitelib}/*
%if 0%{?with_python3}
%files -n python3-%{pypi_name}
%doc README.rst LICENSE
%{python3_sitelib}/*
%{_bindir}/python3-chardetect
%endif # with_python3
%changelog %changelog
* Wed Jul 02 2014 Miro Hrončok <mhroncok@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@lists.fedoraproject.org> - 2.0.1-8 * Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.0.1-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild

View File

@ -1 +1 @@
ec771971bab5dd1943a10362ebd2fd4c python2-chardet-2.0.1.tgz 4a758402eaefd0331bdedc7ecb6f452c chardet-2.2.1.tar.gz