From ad88c22af284dc1e4db9847ebf9a6418f4548a9b Mon Sep 17 00:00:00 2001 From: Bastien Nocera Date: Sun, 21 Jun 2015 18:44:47 +0200 Subject: [PATCH] Split off Python bindings, add Python3 support --- 0001-Python3-support.patch | 51 ++++++++++++++++++++++++++++++++++++++ avahi.spec | 40 +++++++++++++++++++++++++++--- 2 files changed, 88 insertions(+), 3 deletions(-) create mode 100644 0001-Python3-support.patch diff --git a/0001-Python3-support.patch b/0001-Python3-support.patch new file mode 100644 index 0000000..0bd6c64 --- /dev/null +++ b/0001-Python3-support.patch @@ -0,0 +1,51 @@ +From 2ab8bc4d4d393d74dacd23b525715fca7356f996 Mon Sep 17 00:00:00 2001 +From: Bastien Nocera +Date: Tue, 16 Jun 2015 20:39:36 +0200 +Subject: [PATCH] Python3 support + +--- + avahi-python/avahi/ServiceTypeDatabase.py.in | 20 ++++++++++---------- + 1 file changed, 10 insertions(+), 10 deletions(-) + +diff --git a/avahi-python/avahi/ServiceTypeDatabase.py.in b/avahi-python/avahi/ServiceTypeDatabase.py.in +index b2035fd..4ddd654 100644 +--- a/avahi-python/avahi/ServiceTypeDatabase.py.in ++++ b/avahi-python/avahi/ServiceTypeDatabase.py.in +@@ -138,24 +138,24 @@ class ServiceTypeDatabase: + if __name__ == "__main__": + + b = ServiceTypeDatabase() +- print b.items() ++ print (b.items()) + +- print b["_http._tcp"] +- print b["_ftp._tcp"] +- print b["_webdav._tcp"] +- print b["_webdavs._tcp"] ++ print (b["_http._tcp"]) ++ print (b["_ftp._tcp"]) ++ print (b["_webdav._tcp"]) ++ print (b["_webdavs._tcp"]) + +- print b.get("gurki._tcp") +- print len(b) ++ print (b.get("gurki._tcp")) ++ print (len(b)) + + for key, _ in zip(b, xrange(3)): + +- print key ++ print (key) + + for key, _ in zip(b.iteritems(), xrange(3)): + +- print key ++ print (key) + + for key, _ in zip(b.itervalues(), xrange(3)): + +- print key ++ print (key) +-- +2.4.3 + diff --git a/avahi.spec b/avahi.spec index 76d3039..2749c92 100644 --- a/avahi.spec +++ b/avahi.spec @@ -18,7 +18,7 @@ Name: avahi Version: 0.6.31 -Release: 35%{?dist} +Release: 36%{?dist} Summary: Local network service discovery License: LGPLv2+ URL: http://avahi.org @@ -76,6 +76,8 @@ Patch1: avahi-0.6.31-no-deprecations.patch Patch2: 0001-Disable-publish-workstation-and-publish-hinfo-by-def.patch Patch3: 0001-netlink-check-that-the-origin-of-the-rtnetlink-messa.patch +Patch4: 0001-Python3-support.patch + %description Avahi is a system which facilitates service discovery on a local network -- this means that you can plug your laptop or @@ -99,6 +101,7 @@ Requires: %{name} = %{version}-%{release} Requires: %{name}-libs%{?_isa} = %{version}-%{release} Requires: %{name}-glib%{?_isa} = %{version}-%{release} Requires: %{name}-ui-gtk3%{?_isa} = %{version}-%{release} +Requires: python-avahi = %{version}-%{release} Requires: vnc Requires: openssh-clients Requires: pygtk2 @@ -321,12 +324,29 @@ avahi-dnsconfd connects to a running avahi-daemon and runs the script local LAN. This is useful for configuring unicast DNS servers in a DHCP-like fashion with mDNS. +%package -n python-avahi +Summary: Python2 Avahi bindings +Requires: %{name} = %{version}-%{release} +Requires: %{name}-libs%{?_isa} = %{version}-%{release} + +%description -n python-avahi +%{summary}. + +%package -n python3-avahi +Summary: Python3 Avahi bindings +Requires: %{name} = %{version}-%{release} +Requires: %{name}-libs%{?_isa} = %{version}-%{release} + +%description -n python3-avahi +%{summary}. + %prep %setup -q %patch0 -p1 -b .mono-libdir %patch1 -p1 -b .no_deprecations %patch2 -p1 -b .disable-workstation-hinfo %patch3 -p1 -b .netlink-userns +%patch4 -p1 -b .python3 rm docs/INSTALL # patch1 requires autogen @@ -386,6 +406,10 @@ ln -s avahi-compat-libdns_sd.pc %{buildroot}/%{_libdir}/pkgconfig/libdns_sd.pc ln -s avahi-compat-libdns_sd/dns_sd.h %{buildroot}/%{_includedir}/ %endif +# Add python3 support +mkdir -p $RPM_BUILD_ROOT%{_prefix}/lib/python3.4/site-packages/avahi/ +cp -r $RPM_BUILD_ROOT%{_prefix}/lib/python2.?/site-packages/avahi/* $RPM_BUILD_ROOT%{_prefix}/lib/python3.4/site-packages/avahi/ + rm -fv %{buildroot}%{_sysconfdir}/rc.d/init.d/avahi-daemon rm -fv %{buildroot}%{_sysconfdir}/rc.d/init.d/avahi-dnsconfd @@ -557,9 +581,8 @@ exit 0 %{_datadir}/applications/b*.desktop %{_datadir}/appdata/*.appdata.xml %{_datadir}/applications/avahi-discover.desktop -# These are .py files only, so they don't go in lib64 -%{_prefix}/lib/python?.?/site-packages/* %{_datadir}/avahi/interfaces/ +%{_prefix}/lib/python2.?/site-packages/avahi_discover/ %files devel %{_libdir}/libavahi-common.so @@ -664,7 +687,18 @@ exit 0 %{_libdir}/pkgconfig/libdns_sd.pc %endif +%files -n python-avahi +# These are .py files only, so they don't go in lib64 +%{_prefix}/lib/python2.?/site-packages/avahi + +%files -n python3-avahi +# These are .py files only, so they don't go in lib64 +%{_prefix}/lib/python3.?/site-packages/ + %changelog +* Sun Jun 21 2015 Bastien Nocera 0.6.31-36 +- Split off Python bindings, add Python3 support + * Wed Jun 17 2015 Michal Sekletar - 0.6.31-35 - check that rtnetlink messages has pid == 0, i.e. they sender is kernel (#1227052)