Hello community,

here is the log from the commit of package cups-airprint for openSUSE:Factory 
checked in at 2020-05-19 14:45:10
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/cups-airprint (Old)
 and      /work/SRC/openSUSE:Factory/.cups-airprint.new.2738 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "cups-airprint"

Tue May 19 14:45:10 2020 rev:2 rq:806276 version:1.1

Changes:
--------
--- /work/SRC/openSUSE:Factory/cups-airprint/cups-airprint.changes      
2016-03-26 15:24:11.000000000 +0100
+++ /work/SRC/openSUSE:Factory/.cups-airprint.new.2738/cups-airprint.changes    
2020-05-19 14:45:24.979677046 +0200
@@ -1,0 +2,7 @@
+Sun May 17 15:14:05 UTC 2020 - Olav Reinert <[email protected]>
+
+- python3.patch: Port script to python3
+- pdf-support.patch: Fix printer discovery
+- Add minimal build check to verify the script can run at all
+
+-------------------------------------------------------------------

New:
----
  pdf-support.patch
  python3.patch

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ cups-airprint.spec ++++++
--- /var/tmp/diff_new_pack.1FbUGk/_old  2020-05-19 14:45:26.715680755 +0200
+++ /var/tmp/diff_new_pack.1FbUGk/_new  2020-05-19 14:45:26.719680764 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package cups-airprint
 #
-# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2020 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -12,17 +12,17 @@
 # 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/
+# Please submit bugfixes or comments via https://bugs.opensuse.org/
 #
 
 
 Name:           cups-airprint
-Version:        1.0
+Version:        1.1
 Release:        0
 Summary:        AirPrint for CUPS printers
 License:        MIT
 Group:          Hardware/Printing
-Url:            https://github.com/tjfontaine/airprint-generate
+URL:            https://github.com/tjfontaine/airprint-generate
 Source0:        
https://raw.githubusercontent.com/tjfontaine/airprint-generate/master/airprint-generate.py
 Source10:       apple.types
 Source11:       local.convs
@@ -31,17 +31,19 @@
 Source22:       README.SUSE
 Source23:       LICENSE.txt
 Patch0:         airprint-generate.patch
+Patch1:         python3.patch
+Patch2:         pdf-support.patch
+BuildRequires:  python3-pycups
 Requires:       avahi
-# cups-filters >= 1.0.25 provides the urftopdf filter to convert the URF format
-# which (at least some) iOS apps send when printing via AirPrint:
-Requires:       cups-filters >= 1.0.25
 # cups-airprint will not work reasonably well with traditional CUPS <= 1.5.4
 # that has neither built-in DNS-SD/Avahi support nor the urftopdf filter
 # so that in practice a modern CUPS >= 1.6 is required:
 Requires:       cups >= 1.6
-Requires:       python-cups
-Requires:       python-xml
-BuildRoot:      %{_tmppath}/%{name}-%{version}-build
+# cups-filters >= 1.0.25 provides the urftopdf filter to convert the URF format
+# which (at least some) iOS apps send when printing via AirPrint:
+Requires:       cups-filters >= 1.0.25
+Requires:       python3-pycups
+Requires:       python3-xml
 BuildArch:      noarch
 
 %description
@@ -67,12 +69,14 @@
 cp %{SOURCE0} %{SOURCE10} %{SOURCE11} .
 cp %{SOURCE21} %{SOURCE22} %{SOURCE23} .
 %patch0
+%patch1 -p1
+%patch2 -p1
 
 %build
 
 %install
-mkdir -p %{buildroot}%{_prefix}/sbin
-install airprint-generate.py %{buildroot}%{_prefix}/sbin
+mkdir -p %{buildroot}%{_sbindir}
+install airprint-generate.py %{buildroot}%{_sbindir}
 
 mkdir -p %{buildroot}%{_datadir}/cups/mime
 install -m 644 apple.types local.convs %{buildroot}%{_datadir}/cups/mime
@@ -80,15 +84,17 @@
 mkdir -p %{buildroot}%{_mandir}/man8
 install -m 644 %{SOURCE20} %{buildroot}/%{_mandir}/man8
 
+%check
+python3 airprint-generate.py -h
 
 %files
-%defattr(-,root,root)
 %{_sbindir}/airprint-generate.py
 %dir %{_datadir}/cups/
 %dir %{_datadir}/cups/mime
 %{_datadir}/cups/mime/apple.types
 %{_datadir}/cups/mime/local.convs
-%doc CREDITS.txt LICENSE.txt README.SUSE
-%{_mandir}/man8/airprint-generate.py.8.gz
+%license LICENSE.txt
+%doc CREDITS.txt README.SUSE
+%{_mandir}/man8/airprint-generate.py.8%{?ext_man}
 
 %changelog

++++++ pdf-support.patch ++++++
commit 8d1b60bf828ab842731b91af121fcf8a27854811
Author: Olav Reinert <[email protected]>
Date:   Sun May 17 16:47:44 2020 +0200

    Ensure PDF support (via CUPS)
    
    This is needed to ensure that suitable printers are discovered.

diff --git a/airprint-generate.py b/airprint-generate.py
index ed224ff..358d627 100644
--- a/airprint-generate.py
+++ b/airprint-generate.py
@@ -71,6 +71,7 @@ DOCUMENT_TYPES = {
     'application/pdf': True,
     'application/postscript': True,
     'application/vnd.cups-postscript': True,
+    'application/vnd.cups-pdf': True,
     'application/vnd.cups-raster': True,
     'application/octet-stream': True,
     'image/urf': True,
++++++ python3.patch ++++++
commit 86dda7081513a9999dcb73fd46ca88bd23a2b26d
Author: Álvaro Jurado <[email protected]>
Date:   Wed Feb 12 20:00:04 2020 +0100

    Upgrading to python 3
    
    Signed-off-by: Álvaro Jurado <[email protected]>

diff --git a/airprint-generate.py b/airprint-generate.py
old mode 100755
new mode 100644
index 989f63b..1e23178
--- a/airprint-generate.py
+++ b/airprint-generate.py
@@ -22,9 +22,9 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
DEALINGS IN
 THE SOFTWARE.
 """
 
-import cups, os, optparse, re, urlparse
+import cups, os, optparse, re, urllib.parse
 import os.path
-from StringIO import StringIO
+from io import StringIO
 
 from xml.dom.minidom import parseString
 from xml.dom import minidom
@@ -70,6 +70,7 @@ DOCUMENT_TYPES = {
     # These content-types will be at the front of the list
     'application/pdf': True,
     'application/postscript': True,
+    'application/vnd.cups-postscript': True,
     'application/vnd.cups-raster': True,
     'application/octet-stream': True,
     'image/urf': True,
@@ -124,7 +125,7 @@ class AirPrintGenerate(object):
         for p, v in printers.items():
             if v['printer-is-shared']:
                 attrs = conn.getPrinterAttributes(p)
-                uri = urlparse.urlparse(v['printer-uri-supported'])
+                uri = urllib.parse.urlparse(v['printer-uri-supported'])
 
                 tree = ElementTree()
                 tree.parse(StringIO(XML_TEMPLATE.replace('\n', 
'').replace('\r', '').replace('\t', '')))

commit 6365eaf86f0f3128fbc03aa21f4eebd063334f4a
Author: Olav Reinert <[email protected]>
Date:   Sun May 17 16:38:03 2020 +0200

    more python3 fixes

diff --git a/airprint-generate.py b/airprint-generate.py
index 29f1eef..6391b27 100644
--- a/airprint-generate.py
+++ b/airprint-generate.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
 
 """
 Copyright (c) 2010 Timothy J Fontaine <[email protected]>
@@ -43,7 +43,7 @@ except:
             from elementtree import Element, ElementTree, tostring
             etree = None
         except:
-            raise 'Failed to find python libxml or elementtree, please install 
one of those or use python >= 2.5'
+            raise Exception('Failed to find python libxml or elementtree, 
please install one of those or use python >= 2.5')
 
 XML_TEMPLATE = """<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
 <service-group>
@@ -123,7 +123,7 @@ class AirPrintGenerate(object):
             
         printers = conn.getPrinters()
         
-        for p, v in printers.items():
+        for p, v in list(printers.items()):
             if v['printer-is-shared']:
                 attrs = conn.getPrinterAttributes(p)
                 uri = urllib.parse.urlparse(v['printer-uri-supported'])

Reply via email to