Accepting request 785617 from home:scarabeus_iv:branches:Application:Geo

- Allow building without python2 available

OBS-URL: https://build.opensuse.org/request/show/785617
OBS-URL: https://build.opensuse.org/package/show/Application:Geo/gpsd?expand=0&rev=130
This commit is contained in:
Martin Pluskal 2020-03-16 13:22:12 +00:00 committed by Git OBS Bridge
parent bc6a45feb2
commit 3c286260bb
2 changed files with 26 additions and 11 deletions

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Mon Mar 16 12:19:41 UTC 2020 - Tomáš Chvátal <tchvatal@suse.com>
- Allow building without python2 available
------------------------------------------------------------------- -------------------------------------------------------------------
Sat Sep 28 10:00:28 UTC 2019 - Christophe Giboudeaux <christophe@krop.fr> Sat Sep 28 10:00:28 UTC 2019 - Christophe Giboudeaux <christophe@krop.fr>

View File

@ -1,7 +1,7 @@
# #
# spec file for package gpsd # spec file for package gpsd
# #
# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. # Copyright (c) 2020 SUSE LLC
# #
# All modifications and additions to the file contributed by third parties # All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed # remain the property of their copyright owners, unless otherwise agreed
@ -20,6 +20,7 @@
%define libgps libgps%{sover} %define libgps libgps%{sover}
%define libQgps libQgpsmm%{sover} %define libQgps libQgpsmm%{sover}
%define _udevdir %(pkg-config --variable udevdir udev) %define _udevdir %(pkg-config --variable udevdir udev)
%bcond_without python2
Name: gpsd Name: gpsd
Version: 3.19 Version: 3.19
Release: 0 Release: 0
@ -55,7 +56,9 @@ BuildRequires: pkgconfig(Qt5Widgets)
BuildRequires: pkgconfig(bluez) BuildRequires: pkgconfig(bluez)
BuildRequires: pkgconfig(dbus-1) BuildRequires: pkgconfig(dbus-1)
BuildRequires: pkgconfig(libusb-1.0) BuildRequires: pkgconfig(libusb-1.0)
%if %{with python2}
BuildRequires: pkgconfig(python2) BuildRequires: pkgconfig(python2)
%endif
BuildRequires: pkgconfig(python3) BuildRequires: pkgconfig(python3)
BuildRequires: pkgconfig(udev) BuildRequires: pkgconfig(udev)
Requires: udev Requires: udev
@ -187,13 +190,15 @@ sed -i 's|ExecStart=.*/gpsd|ExecStart=%{_sbindir}/gpsd|' python*/%{name}-%{versi
export CFLAGS="%{optflags}" export CFLAGS="%{optflags}"
export CXXFLAGS="%{optflags}" export CXXFLAGS="%{optflags}"
export CPPFLAGS="%{optflags}" export CPPFLAGS="%{optflags}"
pyversions=( "python3" )
pyversions=( python2 python3 ) pylibdir=( "%{python3_sitearch}" )
pylibdir=( %{python2_sitearch} %{python3_sitearch} ) %if %{with python2}
pyversions+=( "python2" )
for i in 0 1 pylibdir+=( "%{python2_sitearch}")
do %endif
pushd %{name}-%{version}/${pyversions[i]}/%{name}-%{version} cnt=0
for i in "${pyversions[@]}"; do
pushd %{name}-%{version}/${i}/%{name}-%{version}
# breaks with %{?_smp_mflags} # breaks with %{?_smp_mflags}
scons \ scons \
@ -213,15 +218,16 @@ do
docdir=%{_docdir} \ docdir=%{_docdir} \
pkgconfigdir=%{_libdir}/pkgconfig \ pkgconfigdir=%{_libdir}/pkgconfig \
udevdir=$(dirname %{_udevrulesdir}) \ udevdir=$(dirname %{_udevrulesdir}) \
target_python=${pyversions[i]} \ target_python=${i} \
python_libdir=${pylibdir[i]} \ python_libdir=${pylibdir[$cnt]} \
build build
# Fix python interpreter path. # Fix python interpreter path.
sed -e "s,#!%{_bindir}/\(python[23]\?\|env \+python[23]\?\),#!%{_bindir}/${pyversions[i]},g" -i \ sed -e "s,#!%{_bindir}/\(python[23]\?\|env \+python[23]\?\),#!%{_bindir}/${i},g" -i \
gegps gpscat gpsfake xgps xgpsspeed gpsprof ubxtool zerk gps/*.py gegps gpscat gpsfake xgps xgpsspeed gpsprof ubxtool zerk gps/*.py
popd popd
cnt=`expr $cnt + 1`
done done
%install %install
@ -230,6 +236,7 @@ export CFLAGS="%{optflags}"
export CXXFLAGS="%{optflags}" export CXXFLAGS="%{optflags}"
export CPPFLAGS="%{optflags}" export CPPFLAGS="%{optflags}"
# Install python2 first # Install python2 first
%if %{with python2}
pushd %{name}-%{version}/python2/%{name}-%{version} pushd %{name}-%{version}/python2/%{name}-%{version}
DESTDIR=%{buildroot} scons nostrip=True install DESTDIR=%{buildroot} scons nostrip=True install
@ -238,6 +245,7 @@ DESTDIR=%{buildroot} scons nostrip=True install
find %{buildroot} \( -not -type d -a -not -path "*/python2.*/*" \) -delete find %{buildroot} \( -not -type d -a -not -path "*/python2.*/*" \) -delete
popd popd
%endif
pushd %{name}-%{version}/python3/%{name}-%{version} pushd %{name}-%{version}/python3/%{name}-%{version}
DESTDIR=%{buildroot} scons nostrip=True install DESTDIR=%{buildroot} scons nostrip=True install
@ -333,9 +341,11 @@ sed -i -e 's#Icon=.*/\([^/]\+\)\(\..\+\)#Icon=\1#' %{buildroot}%{_datadir}/appli
%{_libdir}/pkgconfig/Qgpsmm.pc %{_libdir}/pkgconfig/Qgpsmm.pc
%{_mandir}/man?/libQgps* %{_mandir}/man?/libQgps*
%if %{with python2}
%files -n python2-gpsd %files -n python2-gpsd
%{python_sitearch}/gps/ %{python_sitearch}/gps/
%{python_sitearch}/gps-%{version}.* %{python_sitearch}/gps-%{version}.*
%endif
%files -n python3-gpsd %files -n python3-gpsd
%{python3_sitearch}/gps/ %{python3_sitearch}/gps/