make copy-deviceid.py Python 3 compatible
This commit is contained in:
parent
6ad02065f3
commit
a281e46956
@ -1,9 +1,9 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python3
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
if len (sys.argv) < 3:
|
if len (sys.argv) < 3:
|
||||||
print "Specify hpcups.drv and hpijs.drv pathnames"
|
print ("Specify hpcups.drv and hpijs.drv pathnames")
|
||||||
sys.exit (1)
|
sys.exit (1)
|
||||||
|
|
||||||
hpcups_drv = sys.argv[1]
|
hpcups_drv = sys.argv[1]
|
||||||
@ -23,7 +23,7 @@ end_re = re.compile ('^\s*}')
|
|||||||
|
|
||||||
devid_by_mn = dict()
|
devid_by_mn = dict()
|
||||||
|
|
||||||
hpcups_lines = file (hpcups_drv, "r").readlines ()
|
hpcups_lines = open (hpcups_drv, "r").readlines ()
|
||||||
current_mn = None
|
current_mn = None
|
||||||
for line in hpcups_lines:
|
for line in hpcups_lines:
|
||||||
if current_mn == None:
|
if current_mn == None:
|
||||||
@ -41,12 +41,12 @@ for line in hpcups_lines:
|
|||||||
if end_re.match (line):
|
if end_re.match (line):
|
||||||
current_mn = None
|
current_mn = None
|
||||||
|
|
||||||
print >>sys.stderr, \
|
print("%d IEEE 1284 Device IDs loaded from %s" % (len (devid_by_mn),
|
||||||
"%d IEEE 1284 Device IDs loaded from %s" % (len (devid_by_mn),
|
os.path.basename (hpcups_drv)),
|
||||||
os.path.basename (hpcups_drv))
|
file=sys.stderr)
|
||||||
|
|
||||||
replaced = 0
|
replaced = 0
|
||||||
hpijs_lines = file (hpijs_drv, "r").readlines ()
|
hpijs_lines = open (hpijs_drv, "r").readlines ()
|
||||||
current_mn = None
|
current_mn = None
|
||||||
for line in hpijs_lines:
|
for line in hpijs_lines:
|
||||||
if current_mn == None:
|
if current_mn == None:
|
||||||
@ -63,13 +63,13 @@ for line in hpijs_lines:
|
|||||||
line = (match.groups ()[0] + devid + match.groups ()[2])
|
line = (match.groups ()[0] + devid + match.groups ()[2])
|
||||||
replaced += 1
|
replaced += 1
|
||||||
else:
|
else:
|
||||||
print >>sys.stderr, "Not matched: %s" % current_mn
|
print ("Not matched: %s" % current_mn, file=sys.stderr)
|
||||||
|
|
||||||
if end_re.match (line):
|
if end_re.match (line):
|
||||||
current_mn = None
|
current_mn = None
|
||||||
|
|
||||||
print line.rstrip ("\n")
|
print (line.rstrip ("\n"))
|
||||||
|
|
||||||
print >>sys.stderr, \
|
print("%d IEEE 1284 Device IDs loaded in %s" % (replaced,
|
||||||
"%d IEEE 1284 Device IDs replaced in %s" % (replaced,
|
os.path.basename (hpijs_drv)),
|
||||||
os.path.basename (hpijs_drv))
|
file=sys.stderr)
|
||||||
|
@ -453,7 +453,8 @@ rm -f %{buildroot}%{_sysconfdir}/xdg/autostart/hplip-systray.desktop
|
|||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
* Tue Aug 18 2015 Jiri Popelka <jpopelka@redhat.com> - 3.15.7-5
|
* Tue Aug 18 2015 Jiri Popelka <jpopelka@redhat.com> - 3.15.7-5
|
||||||
- remove compat-libs subpackage (bug #1196237).
|
- remove compat-libs subpackage (bug #1196237)
|
||||||
|
- make copy-deviceid.py Python 3 compatible
|
||||||
|
|
||||||
* Tue Aug 11 2015 Jiri Popelka <jpopelka@redhat.com> - 3.15.7-4
|
* Tue Aug 11 2015 Jiri Popelka <jpopelka@redhat.com> - 3.15.7-4
|
||||||
- Upstream fix for 'Stopped "Filter Failed"' (Launchpad #1476920)
|
- Upstream fix for 'Stopped "Filter Failed"' (Launchpad #1476920)
|
||||||
|
Loading…
Reference in New Issue
Block a user