forked from pool/cups-airprint
Accepting request 806255 from home:oreinert:branches:Printing
- python3.patch: Port script to python3 - pdf-support.patch: Fix printer discovery - Add minimal build check to verify the script can run at all OBS-URL: https://build.opensuse.org/request/show/806255 OBS-URL: https://build.opensuse.org/package/show/Printing/cups-airprint?expand=0&rev=7
This commit is contained in:
parent
7eda2f648e
commit
a5a154994e
@ -1,3 +1,10 @@
|
||||
-------------------------------------------------------------------
|
||||
Sun May 17 15:14:05 UTC 2020 - Olav Reinert <seroton10@gmail.com>
|
||||
|
||||
- python3.patch: Port script to python3
|
||||
- pdf-support.patch: Fix printer discovery
|
||||
- Add minimal build check to verify the script can run at all
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Feb 23 11:03:57 CET 2016 - jsmeix@suse.de
|
||||
|
||||
|
@ -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 @@ Source21: CREDITS.txt
|
||||
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 @@ AirPrint work; please follow the instructions in:
|
||||
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 @@ install -m 644 apple.types local.convs %{buildroot}%{_datadir}/cups/mime
|
||||
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
|
||||
|
20
pdf-support.patch
Normal file
20
pdf-support.patch
Normal file
@ -0,0 +1,20 @@
|
||||
commit 8d1b60bf828ab842731b91af121fcf8a27854811
|
||||
Author: Olav Reinert <seroton10@gmail.com>
|
||||
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,
|
78
python3.patch
Normal file
78
python3.patch
Normal file
@ -0,0 +1,78 @@
|
||||
commit 86dda7081513a9999dcb73fd46ca88bd23a2b26d
|
||||
Author: Álvaro Jurado <elbingmiss@gmail.com>
|
||||
Date: Wed Feb 12 20:00:04 2020 +0100
|
||||
|
||||
Upgrading to python 3
|
||||
|
||||
Signed-off-by: Álvaro Jurado <elbingmiss@gmail.com>
|
||||
|
||||
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 <seroton10@gmail.com>
|
||||
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 <tjfontaine@atxconsulting.com>
|
||||
@@ -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'])
|
Loading…
Reference in New Issue
Block a user