python-dbus-python/python-dbus-python.spec
Marcus Meissner 4796a81a44 Accepting request 479745 from devel:languages:python:singlespec
dbus-1-python with the following changes:
  * updated to the latest version.
  * renamed to match openSUSE python packaging rules, based on the package name on pypi.
  * ported to the new single-spec python system, which provides macros to automatically build packages for multiple python versions at once.

Once this is accepted in openSUSE:Factory, dbus-1-python and dbus-1-python3 should be deleted.

OBS-URL: https://build.opensuse.org/request/show/479745
OBS-URL: https://build.opensuse.org/package/show/Base:System/python-dbus-python?expand=0&rev=1
2017-04-07 07:04:01 +00:00

193 lines
6.4 KiB
RPMSpec

#
# spec file for package python-dbus-python
#
# Copyright (c) 2017 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name: python-dbus-python
Version: 1.2.4
Release: 0
Summary: Python bindings for D-Bus
License: MIT
Group: Development/Libraries/Python
Url: http://www.freedesktop.org/wiki/Software/DBusBindings/
Source: https://files.pythonhosted.org/packages/source/d/dbus-python/dbus-python-%{version}.tar.gz
Source99: python-dbus-python-rpmlintrc
BuildRequires: epydoc
BuildRequires: fdupes
BuildRequires: pkgconfig(dbus-1) >= 1.6.0
BuildRequires: pkgconfig(dbus-glib-1)
BuildRequires: python-rpm-macros
BuildRequires: %{python_module devel}
BuildRequires: %{python_module gobject}
BuildRequires: %{python_module docutils}
BuildRequires: %{python_module xml}
Requires: python-gobject
Requires: python-xml
%ifpython2
Provides: dbus-1-python = %{version}
Provides: dbus-1-python2 = %{version}
Obsoletes: dbus-1-python < %{version}
Obsoletes: dbus-1-python2 < %{version}
%endif
%ifpython3
Provides: dbus-1-python3 = %{version}
Obsoletes: dbus-1-python3 < %{version}
%endif
Requires: dbus-1 >= %( echo `rpm -q --queryformat '%{VERSION}' dbus-1`)
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%python_subpackages
%description
D-Bus python bindings for use with python programs.
%package devel
Summary: Python bindings for D-Bus -- development files
Group: Development/Libraries/Python
Requires: python-devel
Requires: %{name} = %{version}
Requires: %{name}-common-devel = %{version}
Requires: dbus-1 >= %( echo `rpm -q --queryformat '%{VERSION}' dbus-1`)
Requires: dbus-1-devel >= %( echo `rpm -q --queryformat '%{VERSION}' dbus-1-devel`)
%ifpython2
Provides: dbus-1-python-devel = %{version}
Provides: dbus-1-python2-devel = %{version}
Obsoletes: dbus-1-python-devel < %{version}
Obsoletes: dbus-1-python2-devel < %{version}
%endif
%ifpython3
Provides: dbus-1-python3-devel = %{version}
Obsoletes: dbus-1-python3-devel < %{version}
%endif
%description devel
D-Bus python bindings for use with python programs.
This package contains the development files for
Python bindings for D-Bus.
%package -n %{name}-common-devel
Summary: Python bindings for D-Bus -- shared development files
Requires: pkgconfig(dbus-1) >= 1.6.0
Requires: pkgconfig(dbus-glib-1)
Provides: %{python_module dbus-python-common-devel = %{version}}
%description -n %{name}-common-devel
D-Bus python bindings for use with python programs.
This package contains development files shared between
the Python2 and Python3 versions of the bindings.
%prep
%setup -q -n dbus-python-%{version}
# Remove Makefile* (fix rpmlint warning "makefile-junk")
rm -f examples/Makefile*
%build
export CFLAGS="%{optflags} -fstack-protector -fno-strict-aliasing -fPIC"
%define _configure ../configure
%{python_expand mkdir build_%{$python_bin_suffix}
pushd build_%{$python_bin_suffix}
export PYTHON=$python
export pythondir=%{$python_sitearch}
%configure --docdir=%{_docdir}/%{$python_prefix}-dbus-python
make %{?_smp_mflags}
popd
}
%install
%{python_expand pushd build_%{$python_bin_suffix}
%make_install
popd
# Remove libtool config files
rm -f %{buildroot}%{$python_sitearch}/*.la
#avoid conflicts with py2
mv %{buildroot}%{_includedir}/dbus-1.0/dbus/dbus-python.h \
%{buildroot}%{_includedir}/dbus-1.0/dbus/dbus-python-%{$python_bin_suffix}.h
mv %{buildroot}%{_libdir}/pkgconfig/dbus-python.pc \
%{buildroot}%{_libdir}/pkgconfig/dbus-python-%{$python_bin_suffix}.pc
mkdir -p %{buildroot}%{_docdir}/%{$python_prefix}-dbus-python-devel
mv %{buildroot}%{_docdir}/%{$python_prefix}-dbus-python/{API_CHANGES.*,HACKING.*,PY3PORT.*,tutorial.*} %{buildroot}%{_docdir}/%{$python_prefix}-dbus-python-devel/
}
%if 0%{?have_python2} && 0%{?have_python3}
# Check to make sure Python2 and Python3 versions of the header file and pkgconfig file are the same
if [ ! cmp --silent %{buildroot}%{_includedir}/dbus-1.0/dbus/dbus-python-%{python2_bin_suffix}.h %{buildroot}%{_includedir}/dbus-1.0/dbus/dbus-python-%{python3_bin_suffix}.h ] ; then
echo "pkgconfig files are different between python 2 and python 3"
exit 1
fi
if [ ! cmp --silent %{buildroot}%{_libdir}/pkgconfig/dbus-python-%{python2_bin_suffix}.pc %{buildroot}%{_libdir}/pkgconfig/dbus-python-%{python3_bin_suffix}.pc ] ; then
echo "pkgconfig files are different between python 2 and python 3"
exit 1
fi
%endif
%{python_expand mv %{buildroot}%{_includedir}/dbus-1.0/dbus/dbus-python-%{$python_bin_suffix}.h \
%{buildroot}%{_includedir}/dbus-1.0/dbus/dbus-python.h
mv %{buildroot}%{_libdir}/pkgconfig/dbus-python-%{$python_bin_suffix}.pc \
%{buildroot}%{_libdir}/pkgconfig/dbus-python.pc
ln -s %{_includedir}/dbus-1.0/dbus/dbus-python.h \
%{buildroot}%{_includedir}/dbus-1.0/dbus/dbus-python-%{$python_bin_suffix}.h
ln -s %{_libdir}/pkgconfig/dbus-python.pc \
%{buildroot}%{_libdir}/pkgconfig/dbus-python-%{$python_bin_suffix}.pc
}
%fdupes %{buildroot}
%files %{python_files}
%defattr(-,root,root,-)
%doc AUTHORS COPYING ChangeLog NEWS README
%{_docdir}/%{python_prefix}-dbus-python/
%{python_sitelib}/dbus/
%{python_sitearch}/_dbus_bindings.so
%{python_sitearch}/_dbus_glib_bindings.so
%files %{python_files devel}
%defattr(-,root,root,-)
%doc AUTHORS COPYING
%{_docdir}/%{python_prefix}-dbus-python-devel/
%{_includedir}/dbus-1.0/dbus/dbus-python-%{python_bin_suffix}.h
%{_libdir}/pkgconfig/dbus-python-%{python_bin_suffix}.pc
%files -n %{name}-common-devel
%defattr(-,root,root,-)
%doc AUTHORS COPYING
%doc doc/ examples/
%{_includedir}/dbus-1.0/dbus/dbus-python.h
%{_libdir}/pkgconfig/dbus-python.pc
%changelog