Add a python3 subpackage.

- Build the python bindings for both python2 and python3.
- Update requires and provides to be explicit about python versions.
This commit is contained in:
Troy Curtis Jr 2017-10-07 22:43:17 -05:00
parent 593e1b8e49
commit ffe280c641

View File

@ -6,7 +6,7 @@
Name: i2c-tools
Version: 3.1.2
Release: 6%{?dist}
Release: 7%{?dist}
Summary: A heterogeneous set of I2C tools for Linux
License: GPLv2+
URL: https://i2c.wiki.kernel.org/index.php/I2C_Tools
@ -15,7 +15,7 @@ Source0: https://www.kernel.org/pub/software/utils/i2c-tools/%{name}-%{ve
# for /etc/udev/makedev.d resp /etc/modprobe.d ownership
Requires: udev module-init-tools
BuildRequires: perl-generators
BuildRequires: python-devel
BuildRequires: python2-devel python3-devel
ExcludeArch: s390 s390x
%description
@ -41,14 +41,23 @@ what you are doing.
Provides: %{name}-python = %{version}-%{release}
Provides: %{name}-python%{?_isa} = %{version}-%{release}
Obsoletes: %{name}-python < %{version}-%{release}
Summary: Python bindings for Linux SMBus access through i2c-dev
Summary: Python 2 bindings for Linux SMBus access through i2c-dev
%description -n python2-i2c-tools
Python 2 bindings for Linux SMBus access through i2c-dev
%package -n python3-i2c-tools
%{?python_provide:%python_provide python3-i2c-tools}
Summary: Python 3 bindings for Linux SMBus access through i2c-dev
%description -n python3-i2c-tools
Python 3 bindings for Linux SMBus access through i2c-dev
%package perl
Summary: i2c tools written in Perl
%description perl
A collection of tools written in perl for use with i2c devices.
%package devel
Summary: Header files for i2c-tools
@ -65,7 +74,8 @@ pushd eepromer
make CFLAGS="$RPM_OPT_FLAGS -I../include"
popd
pushd py-smbus
CFLAGS="$RPM_OPT_FLAGS -I../include" %{__python} setup.py build
CFLAGS="$RPM_OPT_FLAGS -I../include" %{__python2} setup.py build -b build-py2
CFLAGS="$RPM_OPT_FLAGS -I../include" %{__python3} setup.py build -b build-py3
popd
@ -76,7 +86,8 @@ install -m 755 eepromer/{eepromer,eeprom,eeprog} \
install -m 644 eepromer/{eepromer,eeprom,eeprog}.8 \
$RPM_BUILD_ROOT%{_mandir}/man8
pushd py-smbus
%{__python} setup.py install --skip-build --root=$RPM_BUILD_ROOT
%{__python2} setup.py build -b build-py2 install --skip-build --root=$RPM_BUILD_ROOT
%{__python3} setup.py build -b build-py3 install --skip-build --root=$RPM_BUILD_ROOT
popd
# cleanup
rm -f $RPM_BUILD_ROOT%{_bindir}/decode-edid.pl
@ -127,9 +138,11 @@ exit 0
%files -n python2-i2c-tools
%doc py-smbus/README
#/usr/lib64/python2.7/site-packages/smbus-1.1-py2.7.egg-info
#/usr/lib64/python2.7/site-packages/smbus.so
%{python_sitearch}/*
%{python2_sitearch}/*
%files -n python3-i2c-tools
%doc py-smbus/README
%{python3_sitearch}/*
%files perl
%{_bindir}/decode-*
@ -142,6 +155,9 @@ exit 0
%changelog
* Sat Oct 7 2017 Troy Curtis, Jr <troycurtisjr@gmail.com> - 3.1.2-7
- Add Python3 subpackage.
* Sun Aug 20 2017 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 3.1.2-6
- Add Provides for the old name without %%_isa