diff --git a/lcm.spec b/lcm.spec index 96d6fa9..38027e0 100644 --- a/lcm.spec +++ b/lcm.spec @@ -8,7 +8,7 @@ Name: lcm Version: 1.3.1 -Release: 1%{?dist} +Release: 2%{?dist} License: LGPLv2+ Summary: Utilities for lightweight communications and marshaling URL: https://lcm-proj.github.io/ @@ -24,7 +24,8 @@ ExcludeArch: ppc ppc64 BuildRequires: chrpath BuildRequires: glib2-devel BuildRequires: gettext -BuildRequires: python-devel +BuildRequires: python2-devel +BuildRequires: python3-devel %description LCM is a library for message passing and data marshaling targeted at real time @@ -66,11 +67,26 @@ systems where high-bandwidth and low latency are critical. This package provides the java documentation. -%package python -Summary: Lightweight communications and marshaling python bindings +%package -n python2-%{name} +Summary: Lightweight communications and marshaling Python 2 bindings Group: System Environment/Libraries +%{?python_provide:%python_provide python2-%{name}} +Provides: %{name}-python%{?_isa} = %{version}-%{release} +Provides: %{name}-python = %{version}-%{release} +Obsoletes: %{name}-python%{?_isa} < %{version}-%{release} +Obsoletes: %{name}-python < %{version}-%{release} -%description python +%description -n python2-%{name} +LCM is a library for message passing and data marshaling targeted at real time +systems where high-bandwidth and low latency are critical. + + +%package -n python3-%{name} +Summary: Lightweight communications and marshaling Python 3 bindings +Group: System Environment/Libraries +%{?python_provide:%python_provide python3-%{name}} + +%description -n python3-%{name} LCM is a library for message passing and data marshaling targeted at real time systems where high-bandwidth and low latency are critical. @@ -97,8 +113,29 @@ This package provides the development files for the various lcm packages. %prep %setup -q +# Make a dir for building lcm with Python 2 bindings and copy sources there +mkdir PYTHON2_BUILD_DIR +# This allows the !(globing) syntax so cp doesn't throw an error that it can't +# copy a directory into itself +shopt -s extglob +# It is important to add the -a archive flag, bucause the make file is checking +# timestamps of certain files +cp -ar !(PYTHON2_BUILD_DIR) PYTHON2_BUILD_DIR/ %build +# Build with Python 2 bindings in a separate directory +pushd PYTHON2_BUILD_DIR +export PYTHON=%{__python2} +%configure \ + --disable-static \ + --disable-rpath \ + --without-examples \ + --with-jardir=%{_datadir}/java +make V=1 %{?_smp_mflags} +popd + +# Build with Python 3 bindings +export PYTHON=%{__python3} %configure \ --disable-static \ --disable-rpath \ @@ -109,6 +146,13 @@ make V=1 %{?_smp_mflags} %install rm -rf %{buildroot} + +# Install with Python 2 bindings +pushd PYTHON2_BUILD_DIR +make DESTDIR=%{buildroot} install +popd + +# Install with Python 3 bindings make DESTDIR=%{buildroot} install %{javadoc} -Xdoclint:none -d %{buildroot}/%{_javadocdir}/%{name} -sourcepath lcm-java \ @@ -118,7 +162,8 @@ make DESTDIR=%{buildroot} install find %{buildroot}%{_libdir} -type f -name "*.la" -delete -print find %{buildroot}%{_bindir} -type f -name "lcm-logplayer" -print -exec chrpath --delete {} \; find %{buildroot}%{_bindir} -type f -name "lcm-logger" -print -exec chrpath --delete {} \; -find %{buildroot}%{python_sitearch} -type f -name "_lcm.so" -print -exec chrpath --delete {} \; +find %{buildroot}%{python2_sitearch} -type f -name "_lcm.so" -print -exec chrpath --delete {} \; +find %{buildroot}%{python3_sitearch} -type f -name "_lcm.so" -print -exec chrpath --delete {} \; %clean rm -rf %{buildroot} @@ -160,9 +205,14 @@ make check V=1 %{_javadocdir}/%{name}/ -%files python +%files -n python2-%{name} %defattr(-,root,root,-) -%{python_sitearch}/lcm/ +%{python2_sitearch}/lcm/ + + +%files -n python3-%{name} +%defattr(-,root,root,-) +%{python3_sitearch}/lcm/ %files devel @@ -175,6 +225,13 @@ make check V=1 %changelog +* Wed Aug 24 2016 Tomas Orsava - 1.3.1-2 +- Added support for Python 3 — new subpackage python3-lcm +- The package is now being built two times, once with Python 2 bindings and + the second time with Python 3 bindings +- Renamed subpackage lcm-python to python2-lcm, added Provides and Obsoletes + for the name lcm-python + * Mon Aug 15 2016 Dan Callaghan - 1.3.1-1 - new upstream release 1.3.1