From be55468a100459736f85556f12787ea927041185 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Tue, 5 Sep 2017 20:20:23 +0200 Subject: [PATCH] Cleanup packaging and fix archful provide in noarch package Signed-off-by: Igor Gnatenko --- pyusb.spec | 74 +++++++++++++++++------------------------------------- 1 file changed, 23 insertions(+), 51 deletions(-) diff --git a/pyusb.spec b/pyusb.spec index d3ab2d7..aa29da5 100644 --- a/pyusb.spec +++ b/pyusb.spec @@ -1,22 +1,10 @@ -%if 0%{?fedora} > 12 -%global with_python3 1 -%{!?python3_sitearch: %define python_sitearch %(%{__python3} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")} -%else -%{!?python_sitearch: %define python_sitearch %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")} -%endif - Name: pyusb Version: 1.0.0 -Release: 6%{?dist} +Release: 7%{?dist} Summary: Python bindings for libusb -Group: Development/Languages -License: BSD +License: BSD URL: http://pyusb.sourceforge.net/ -Source0: Source0: http://downloads.sourceforge.net/%{name}/%{name}-%{version}.zip -BuildRequires: python2-devel -%if 0%{?with_python3} -BuildRequires: python3-devel -%endif # if with_python3 +Source0: http://downloads.sourceforge.net/%{name}/%{name}-%{version}.zip BuildRequires: libusb-devel BuildArch: noarch @@ -29,64 +17,48 @@ methods to support most USB operations. %package -n python2-pyusb Summary: %summary %{?python_provide:%python_provide python2-pyusb} +BuildRequires: python2-devel # Remove before F30 -Provides: pyusb%{?_isa} = %{version}-%{release} -Obsoletes: pyusb < %{version}-%{release} +Provides: pyusb = %{version}-%{release} +Obsoletes: pyusb < %{version}-%{release} %description -n python2-pyusb %_description -%if 0%{?with_python3} %package -n python3-pyusb -Summary: Python 3 bindings for libusb -Group: Development/Languages +Summary: %summary +%{?python_provide:%python_provide python3-pyusb} +BuildRequires: python3-devel %description -n python3-pyusb PyUSB provides easy USB access to python. The module contains classes and methods to support most USB operations. -%endif # with_python3 %prep -%setup -q -n %{name}-%{version} - -%if 0%{?with_python3} -rm -rf %{py3dir} -cp -a . %{py3dir} -find %{py3dir} -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python3}|' -%endif # with_python3 - -find -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python}|' - -%build -CFLAGS="$RPM_OPT_FLAGS" %{__python2} setup.py build +%autosetup sed -i -e 's/\r//g' README.rst -%if 0%{?with_python3} -pushd %{py3dir} -CFLAGS="$RPM_OPT_FLAGS" %{__python3} setup.py build -popd -%endif # with_python3 - +%build +%py2_build +%py3_build %install -%if 0%{?with_python3} -pushd %{py3dir} -%{__python3} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT -%endif - -%{__python2} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT - +%py2_install +%py3_install %files -n python2-pyusb -%doc README.rst LICENSE -%{python_sitelib}/* +%license LICENSE +%doc README.rst +%{python2_sitelib}/* -%if 0%{?with_python3} %files -n python3-pyusb -%doc README.rst LICENSE +%license LICENSE +%doc README.rst %{python3_sitelib}/* -%endif # with_python3 %changelog +* Tue Sep 05 2017 Igor Gnatenko - 1.0.0-7 +- Cleanup packaging and fix archful provide in noarch package + * Sat Aug 19 2017 Zbigniew Jędrzejewski-Szmek - 1.0.0-6 - Python 2 binary package renamed to python2-pyusb See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3