Follow new packaging guidelines

Signed-off-by: Igor Gnatenko <ignatenko@redhat.com>

https://bugzilla.redhat.com/show_bug.cgi?id=1327033
This commit is contained in:
Igor Gnatenko 2016-04-14 08:58:51 +02:00 committed by Kamil Dudka
parent 40f3b8bafb
commit 3e1f14a8c8

View File

@ -1,26 +1,16 @@
%{!?py3dir: %global py3dir %{_builddir}/python3-%{name}-%{version}-%{release}}
%{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")}
%global modname pycurl
Name: python-pycurl
Name: python-%{modname}
Version: 7.43.0
Release: 2%{?dist}
Release: 3%{?dist}
Summary: A Python interface to libcurl
Group: Development/Languages
License: LGPLv2+ or MIT
URL: http://pycurl.sourceforge.net/
Source0: https://dl.bintray.com/pycurl/pycurl/pycurl-%{version}.tar.gz
BuildRequires: python-devel
BuildRequires: python3-devel
BuildRequires: curl-devel >= 7.21.5
BuildRequires: openssl-devel
BuildRequires: pyflakes
BuildRequires: python-bottle
BuildRequires: python-nose
BuildRequires: python3-bottle
BuildRequires: python3-nose
BuildRequires: python3-pyflakes
BuildRequires: vsftpd
# During its initialization, PycURL checks that the actual libcurl version
@ -31,9 +21,6 @@ BuildRequires: vsftpd
%global libcurl_sed '/^#define LIBCURL_VERSION "/!d;s/"[^"]*$//;s/.*"//;q'
%global curlver_h /usr/include/curl/curlver.h
%global libcurl_ver %(sed %{libcurl_sed} %{curlver_h} 2>/dev/null || echo 0)
Requires: libcurl%{?_isa} >= %{libcurl_ver}
Provides: pycurl = %{version}-%{release}
%description
PycURL is a Python interface to libcurl. PycURL can be used to fetch
@ -41,17 +28,44 @@ objects identified by a URL from a Python program, similar to the
urllib Python module. PycURL is mature, very fast, and supports a lot
of features.
%package -n python3-pycurl
Summary: A Python interface to libcurl for Python 3
%package -n python2-%{modname}
Summary: Python interface to libcurl for Python 2
%{?python_provide:%python_provide python2-%{modname}}
BuildRequires: python2-devel
BuildRequires: python-bottle
BuildRequires: python2-nose
BuildRequires: python-pyflakes
Requires: libcurl%{?_isa} >= %{libcurl_ver}
%description -n python3-pycurl
Provides: %{modname} = %{version}-%{release}
%description -n python2-%{modname}
PycURL is a Python interface to libcurl. PycURL can be used to fetch
objects identified by a URL from a Python program, similar to the
urllib Python module. PycURL is mature, very fast, and supports a lot
of features.
Python 2 version.
%package -n python3-%{modname}
Summary: Python interface to libcurl for Python 3
%{?python_provide:%python_provide python3-%{modname}}
BuildRequires: python3-devel
BuildRequires: python3-bottle
BuildRequires: python3-nose
BuildRequires: python3-pyflakes
Requires: libcurl%{?_isa} >= %{libcurl_ver}
%description -n python3-%{modname}
PycURL is a Python interface to libcurl. PycURL can be used to fetch
objects identified by a URL from a Python program, similar to the
urllib Python module. PycURL is mature, very fast, and supports a lot
of features.
Python 3 version.
%prep
%setup0 -q -n pycurl-%{version}
%autosetup -n %{modname}-%{version}
# remove binaries packaged by upstream
rm -f tests/fake-curl/libcurl/*.so
@ -67,48 +81,42 @@ sed -e 's/ --show-skipped//' \
-e 's/ --with-flaky//' \
-i tests/run.sh
# copy the whole directory for the python3 build
rm -rf %{py3dir}
cp -a . %{py3dir}
%build
export CFLAGS="$RPM_OPT_FLAGS"
%{__python} setup.py build --with-nss
pushd %{py3dir}
%{__python3} setup.py build --with-nss
popd
%check
export PYTHONPATH=$RPM_BUILD_ROOT%{python_sitearch}
make test PYTHON=%{__python}
rm -fv tests/fake-curl/libcurl/*.so
pushd %{py3dir}
export PYTHONPATH=$RPM_BUILD_ROOT%{python3_sitearch}
make test PYTHON=%{__python3} NOSETESTS="nosetests-%{python3_version} -v"
rm -fv tests/fake-curl/libcurl/*.so
popd
%py2_build -- --with-nss
%py3_build -- --with-nss
%install
%{__python} setup.py install -O1 --skip-build --root %{buildroot}
pushd %{py3dir}
%{__python3} setup.py install -O1 --skip-build --root %{buildroot}
popd
%py2_install
%py3_install
rm -rf %{buildroot}%{_datadir}/doc/pycurl
%check
export PYTHONPATH=%{buildroot}%{python2_sitearch}
make test PYTHON=%{__python2} NOSETESTS="nosetests-%{python2_version} -v"
rm -fv tests/fake-curl/libcurl/*.so
export PYTHONPATH=%{buildroot}%{python3_sitearch}
make test PYTHON=%{__python3} NOSETESTS="nosetests-%{python3_version} -v"
rm -fv tests/fake-curl/libcurl/*.so
%files
%{!?_licensedir:%global license %%doc}
%license COPYING-LGPL COPYING-MIT
%doc ChangeLog README.rst examples doc tests
%{python_sitearch}/*
%{python2_sitearch}/curl/
%{python2_sitearch}/%{modname}.so
%{python2_sitearch}/%{modname}-%{version}-*.egg-info
%files -n python3-pycurl
# TODO: find the lost COPYING file
%{!?_licensedir:%global license %%doc}
%license COPYING-LGPL COPYING-MIT
%doc ChangeLog README.rst examples doc tests
%{python3_sitearch}/*
%{python3_sitearch}/curl/
%{python3_sitearch}/%{modname}.*.so
%{python3_sitearch}/%{modname}-%{version}-*.egg-info
%changelog
* Thu Apr 14 2016 Igor Gnatenko <ignatenko@redhat.com> - 7.43.0-3
- Follow new packaging guidelines
* Fri Feb 26 2016 Kamil Dudka <kdudka@redhat.com> - 7.43.0-2
- require libcurl of the same architecture as python-pycurl