diff --git a/.gitignore b/.gitignore index 6de9c70..961c636 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ pyusb-0.4.1.tar.gz /pyusb-1.0.0-a1.tar.gz /pyusb-1.0.0a2.tar.gz /pyusb-1.0.0a3.tar.gz +/pyusb-1.0.0b1.zip diff --git a/pyusb.spec b/pyusb.spec index a722b34..4dabc7c 100644 --- a/pyusb.spec +++ b/pyusb.spec @@ -1,16 +1,23 @@ -%{!?python_sitearch: %define python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")} +%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 -%global alphatag a3 +%global alphatag b1 Name: pyusb Version: 1.0.0 -Release: 0.7.%{alphatag}%{?dist} +Release: 0.8.%{alphatag}%{?dist} Summary: Python bindings for libusb Group: Development/Languages License: BSD URL: http://pyusb.sourceforge.net/ -Source0: pyusb-%{version}%{alphatag}.tar.gz -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) -BuildRequires: python-devel +Source0: Source0: http://downloads.sourceforge.net/%{name}/%{name}-%{version}%{alphatag}.zip +BuildRequires: python2-devel +%if 0%{?with_python3} +BuildRequires: python3-devel +%endif # if with_python3 BuildRequires: libusb-devel BuildArch: noarch @@ -18,30 +25,64 @@ BuildArch: noarch PyUSB provides easy USB access to python. The module contains classes and methods to support most USB operations. +%if 0%{?with_python3} +%package -n python3-pyusb +Summary: Python 3 bindings for libusb +Group: Development/Languages + +%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}%{alphatag} +%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" %{__python} setup.py build +CFLAGS="$RPM_OPT_FLAGS" %{__python2} setup.py build 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 + + %install -rm -rf $RPM_BUILD_ROOT -%{__python} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT - -%clean -rm -rf $RPM_BUILD_ROOT +%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 %files -%defattr(-,root,root,-) %doc README.rst LICENSE %{python_sitelib}/* +%if 0%{?with_python3} +%files -n python3-pyusb +%doc README.rst LICENSE +%{python3_sitelib}/* +%endif # with_python3 %changelog -* Fri Sep 13 2013 Fedora Release Engineering - 1.0.0-0.7.a3 +* Mon Nov 11 2013 Jon Ciesla - 1.0.0-0.8.b1 +- Latest upstream. +- Add python3 support, spec cleanup, BZ 1022851. +- Fixed changelog. + +* Fri Sep 13 2013 Jon Ciesla - 1.0.0-0.7.a3 - Latest upstream. * Sun Aug 04 2013 Fedora Release Engineering - 1.0.0-0.6.a2 diff --git a/sources b/sources index 9c3d254..722a0e1 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -e83e12621149a0d76410aa5cec35ad22 pyusb-1.0.0a3.tar.gz +ba5d0a3ab1b758a0a0cb1dfa56e64e91 pyusb-1.0.0b1.zip