%{!?python3_sitearch: %define python3_sitearch %(python3 -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
%{!?python3_sitelib: %global python3_sitelib %(python3 -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}

%define dbus_glib_version 	0.70
%define dbus_version 		1.6
%define pkg_release		3%{?_dist_release}

Name:		dbus-python3
Summary:	D-Bus Python3 Bindings 
Summary(ja):	D-Bus Python3 バインディング
Version:	1.2.0
Release:	%{pkg_release}

Group:		System Environment/Libraries
License:	MIT
URL:		http://www.freedesktop.org/software/dbus/

Source0:	http://dbus.freedesktop.org/releases/dbus-python/dbus-python-%{version}.tar.gz

BuildRoot:	%{_tmppath}/%{name}-%{version}-root
BuildRequires:	dbus-devel >= %{dbus_version}
BuildRequires:	dbus-glib-devel >= %{dbus_glib_version}
BuildRequires:	python3-devel
Requires:	python3

%description
D-Bus python3 bindings for use with python programs.   

%description -l ja
D-Bus を python3 プログラムから使う為のバインディングです。   


%prep
%setup -q -n dbus-python-%{version}

%build
%configure PYTHON=/usr/bin/python3
%{__make} %{?_smp_mflags}


%install
%{__rm} -rf ${RPM_BUILD_ROOT}
%{__make} install DESTDIR=${RPM_BUILD_ROOT}

# remove unnecessary *.la files
find ${RPM_BUILD_ROOT} -name '*.la' -exec rm -f {} \;

# remove conflict files with dbus-python
rm -f ${RPM_BUILD_ROOT}%{_includedir}/dbus-1.0/dbus/dbus-python.h
rm -f ${RPM_BUILD_ROOT}%{_libdir}/pkgconfig/dbus-python.pc
rm -f ${RPM_BUILD_ROOT}%{_docdir}/dbus-python/*


%clean
rm -rf ${RPM_BUILD_ROOT}

%files
%defattr(-,root,root)
%doc COPYING ChangeLog README NEWS
%{python3_sitearch}/*.so
%{python3_sitelib}/dbus/*.py*
%{python3_sitelib}/dbus/mainloop/*.py*

%changelog
* Tue Jun 28 2016 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.2.0-3
- rebuild with python3-3.5.2

* Sun May 31 2015 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.2.0-2
- rebuild with python3-3.4.3

* Sun Apr 13 2014 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.2.0-1
- initial build