Split off Python bindings, add Python3 support

This commit is contained in:
Bastien Nocera 2015-06-21 18:44:47 +02:00
parent 3b52db469b
commit ad88c22af2
2 changed files with 88 additions and 3 deletions

View File

@ -0,0 +1,51 @@
From 2ab8bc4d4d393d74dacd23b525715fca7356f996 Mon Sep 17 00:00:00 2001
From: Bastien Nocera <hadess@hadess.net>
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

View File

@ -18,7 +18,7 @@
Name: avahi Name: avahi
Version: 0.6.31 Version: 0.6.31
Release: 35%{?dist} Release: 36%{?dist}
Summary: Local network service discovery Summary: Local network service discovery
License: LGPLv2+ License: LGPLv2+
URL: http://avahi.org 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 Patch2: 0001-Disable-publish-workstation-and-publish-hinfo-by-def.patch
Patch3: 0001-netlink-check-that-the-origin-of-the-rtnetlink-messa.patch Patch3: 0001-netlink-check-that-the-origin-of-the-rtnetlink-messa.patch
Patch4: 0001-Python3-support.patch
%description %description
Avahi is a system which facilitates service discovery on Avahi is a system which facilitates service discovery on
a local network -- this means that you can plug your laptop or 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}-libs%{?_isa} = %{version}-%{release}
Requires: %{name}-glib%{?_isa} = %{version}-%{release} Requires: %{name}-glib%{?_isa} = %{version}-%{release}
Requires: %{name}-ui-gtk3%{?_isa} = %{version}-%{release} Requires: %{name}-ui-gtk3%{?_isa} = %{version}-%{release}
Requires: python-avahi = %{version}-%{release}
Requires: vnc Requires: vnc
Requires: openssh-clients Requires: openssh-clients
Requires: pygtk2 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 local LAN. This is useful for configuring unicast DNS servers in a DHCP-like
fashion with mDNS. 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 %prep
%setup -q %setup -q
%patch0 -p1 -b .mono-libdir %patch0 -p1 -b .mono-libdir
%patch1 -p1 -b .no_deprecations %patch1 -p1 -b .no_deprecations
%patch2 -p1 -b .disable-workstation-hinfo %patch2 -p1 -b .disable-workstation-hinfo
%patch3 -p1 -b .netlink-userns %patch3 -p1 -b .netlink-userns
%patch4 -p1 -b .python3
rm docs/INSTALL rm docs/INSTALL
# patch1 requires autogen # 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}/ ln -s avahi-compat-libdns_sd/dns_sd.h %{buildroot}/%{_includedir}/
%endif %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-daemon
rm -fv %{buildroot}%{_sysconfdir}/rc.d/init.d/avahi-dnsconfd rm -fv %{buildroot}%{_sysconfdir}/rc.d/init.d/avahi-dnsconfd
@ -557,9 +581,8 @@ exit 0
%{_datadir}/applications/b*.desktop %{_datadir}/applications/b*.desktop
%{_datadir}/appdata/*.appdata.xml %{_datadir}/appdata/*.appdata.xml
%{_datadir}/applications/avahi-discover.desktop %{_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/ %{_datadir}/avahi/interfaces/
%{_prefix}/lib/python2.?/site-packages/avahi_discover/
%files devel %files devel
%{_libdir}/libavahi-common.so %{_libdir}/libavahi-common.so
@ -664,7 +687,18 @@ exit 0
%{_libdir}/pkgconfig/libdns_sd.pc %{_libdir}/pkgconfig/libdns_sd.pc
%endif %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 %changelog
* Sun Jun 21 2015 Bastien Nocera <bnocera@redhat.com> 0.6.31-36
- Split off Python bindings, add Python3 support
* Wed Jun 17 2015 Michal Sekletar <msekleta@redhat.com> - 0.6.31-35 * Wed Jun 17 2015 Michal Sekletar <msekleta@redhat.com> - 0.6.31-35
- check that rtnetlink messages has pid == 0, i.e. they sender is kernel (#1227052) - check that rtnetlink messages has pid == 0, i.e. they sender is kernel (#1227052)