Accepting request 726827 from home:mwilck:branches:devel:languages:python

- Package /usr/lib/rpm/postscriptdriver.prov again, in the
  new "cups-rpm-helper" subpackage (bsc#735865). The file hasn't
  been packaged any more after the switch from python-cups to 
  python-pycups (sr#502741).
  * removed revert-postscriptdriver.prov-py3.patch
    (we use python3 now)

OBS-URL: https://build.opensuse.org/request/show/726827
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-pycups?expand=0&rev=9
This commit is contained in:
Tomáš Chvátal 2019-08-28 23:33:54 +00:00 committed by Git OBS Bridge
parent 5038de1ee9
commit 1fae79a7f6
3 changed files with 29 additions and 144 deletions

View File

@ -1,3 +1,13 @@
-------------------------------------------------------------------
Wed Aug 28 19:22:11 UTC 2019 - Martin Wilck <mwilck@suse.com>
- Package /usr/lib/rpm/postscriptdriver.prov again, in the
new "cups-rpm-helper" subpackage (bsc#735865). The file hasn't
been packaged any more after the switch from python-cups to
python-pycups (sr#502741).
* removed revert-postscriptdriver.prov-py3.patch
(we use python3 now)
-------------------------------------------------------------------
Tue May 14 20:43:51 UTC 2019 - svasudevan@suse.com

View File

@ -12,7 +12,7 @@
# 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/
#
@ -22,12 +22,10 @@ Name: python-pycups
Version: 1.9.74
Release: 0
Summary: Python Bindings for CUPS
License: GPL-2.0+
License: GPL-2.0-or-later
Group: Development/Libraries/Python
Url: http://cyberelk.net/tim/software/pycups/
Source: https://files.pythonhosted.org/packages/source/p/pycups/pycups-%{version}.tar.bz2
# PATCH-FIX-OPENSUSE revert-postscriptdriver.prov-py3.patch switch back to python2
Patch0: revert-postscriptdriver.prov-py3.patch
BuildRequires: %{python_module devel}
BuildRequires: cups-devel
BuildRequires: fdupes
@ -46,9 +44,20 @@ Provides: python3-cups = %{version}
%description
Python Bindings for CUPS, the Common Unix Printing System
%package -n cups-rpm-helper
Summary: RPM macros for building cups drivers
Group: Development/Libraries/Python
Url: https://fedoraproject.org/wiki/Features/AutomaticPrintDriverInstallation
Requires: python3-cups
Requires: rpm-build
Supplements: (rpm-build and cups-devel)
%description -n cups-rpm-helper
RPM helper scripts to create automatic "Provides:" tags for printer
driver RPMs.
%prep
%setup -q -n pycups-%{version}
%patch0 -p1
%build
export CFLAGS="%{optflags}"
@ -57,6 +66,7 @@ export CFLAGS="%{optflags}"
%install
%python_install
%python_expand %fdupes %{buildroot}%{$python_sitearch}
make install-rpmhook DESTDIR=%{buildroot}
%files %{python_files}
%defattr(-,root,root)
@ -65,4 +75,8 @@ export CFLAGS="%{optflags}"
%{python_sitearch}/cups*.so
%{python_sitearch}/pycups-%{version}-py*.egg-info
%files -n cups-rpm-helper
%{_rpmconfigdir}/fileattrs/psdriver.attr
%{_rpmconfigdir}/postscriptdriver.prov
%changelog

View File

@ -1,139 +0,0 @@
From: Benoît Monin <benoit.monin@gmx.fr>
Date: Sun, 8 Mar 2015 13:14:03 +0100
Subject: [PATCH] Revert "Converted postscriptdriver.prov to Python3."
Upstream: no
This reverts commit 83d0ee6cbafbc7f9abec72d4062643d51fe37974.
Upstream switched to python3 but we're building a pyhon2 package, so revert.
---
postscriptdriver.prov | 64 ++++++++++++++++++++-------------------------------
1 file changed, 25 insertions(+), 39 deletions(-)
diff --git a/postscriptdriver.prov b/postscriptdriver.prov
index 21c1116..7bf74b1 100755
--- a/postscriptdriver.prov
+++ b/postscriptdriver.prov
@@ -1,6 +1,6 @@
-#!/usr/bin/python3
+#!/usr/bin/python
-## Copyright (C) 2009, 2010, 2014 Red Hat, Inc.
+## Copyright (C) 2009, 2010 Red Hat, Inc.
## Author: Tim Waugh <twaugh@redhat.com>
## This program is free software; you can redistribute it and/or modify
@@ -54,7 +54,7 @@ class DeviceIDs:
def get_tags (self):
ret = []
- for mfg, mdlset in self.ids.items ():
+ for mfg, mdlset in self.ids.iteritems ():
mfgl = mfg.lower ().replace (" ", "_")
for mdl in mdlset:
mdll = mdl.lower ().replace (" ", "_")
@@ -65,7 +65,7 @@ class DeviceIDs:
def __add__ (self, other):
if isinstance(other, DeviceIDs):
- for omfg, omdlset in other.ids.items ():
+ for omfg, omdlset in other.ids.iteritems ():
try:
mdlset = self.ids[omfg]
except KeyError:
@@ -121,7 +121,7 @@ class PPDDriver(Driver):
def examine_file (self, path):
try:
ppd = cups.PPD (path)
- except RuntimeError:
+ except RuntimeError, e:
# Not a PPD file. Perhaps it's a drv file.
drv = DrvDriver (path)
self.ids += drv.list ()
@@ -164,16 +164,16 @@ class DynamicDriver(Driver):
posix.kill (p.pid, signal.SIGKILL)
raise
- if stderr:
- print(stderr.decode (), file=sys.stderr)
+ if stderr:
+ print >> sys.stderr, stderr
- ppds = []
- lines = stdout.decode ().split ('\n')
- for line in lines:
- l = shlex.split (line)
- if len (l) < 5:
- continue
- self.ids += l[4]
+ ppds = []
+ lines = stdout.split ('\n')
+ for line in lines:
+ l = shlex.split (line)
+ if len (l) < 5:
+ continue
+ self.ids += l[4]
return Driver.list (self)
@@ -211,35 +211,22 @@ class DrvDriver(PPDDriver):
posix.kill (p.pid, signal.SIGKILL)
raise
- for (dirpath, dirnames, filenames) in os.walk (outputdir,
- topdown=False):
- for filename in filenames:
- path = dirpath + os.path.sep + filename
- self.examine_file (path)
- try:
- os.unlink (path)
- except OSError:
- pass
-
- for dirname in dirnames:
- try:
- os.rmdir (dirpath + os.paht.sep + dirname)
- except OSError:
- pass
-
- try:
- os.rmdir (outputdir)
- except OSError:
- pass
-
+ os.path.walk (outputdir, self.examine_directory, None)
+ os.rmdir (outputdir)
return Driver.list (self)
+ def examine_directory (self, unused, dirname, fnames):
+ for fname in fnames:
+ path = dirname + os.path.sep + fname
+ self.examine_file (path)
+ os.unlink (path)
+
class TagBuilder:
def __init__ (self, filelist=None):
if filelist == None:
filelist = sys.stdin
- paths = [x.rstrip () for x in filelist.readlines ()]
+ paths = map (lambda x: x.rstrip (), filelist.readlines ())
self.ids = DeviceIDs ()
for path in paths:
@@ -248,8 +235,7 @@ class TagBuilder:
self.ids += DynamicDriver (path).list ()
except TimedOut:
pass
- except OSError as exc:
- (e, s) = exc.args
+ except OSError, (e, s):
if e == errno.EACCES or e == errno.ENOENT:
# Not executable
pass
@@ -270,4 +256,4 @@ if __name__ == "__main__":
builder = TagBuilder ()
tags = builder.get_tags ()
for tag in tags:
- print (tag)
+ print tag