+lsb (4.1+Debian8) UNRELEASED; urgency=low
+
+ * Fix initdutils for compatibility with Python 3.
+
+ -- Jeff Licquia <licquia@debian.org> Sun, 15 Jul 2012 15:08:26 -0400
+
lsb (4.1+Debian7) unstable; urgency=low
* lsb-desktop: Demote Qt3 dependency to a Recommends. Closes: #604360
# Support for scanning init scripts for LSB info
-import re, sys, os, cStringIO
-import cPickle
+import re, sys, os
+import pickle
try:
- assert True
-except:
- True = 1
- False = 0
+ from io import StringIO
+except ImportError:
+ from cStringIO import StringIO
class RFC822Parser(dict):
"A dictionary-like object."
def __init__(self, fileob=None, strob=None, startcol=0, basedict=None):
if not fileob and not strob:
- raise ValueError, 'need a file or string'
+ raise ValueError('need a file or string')
if not basedict:
basedict = {}
super(RFC822Parser, self).__init__(basedict)
if not fileob:
- fileob = cStringIO.StringIO(strob)
+ fileob = StringIO(strob)
key = None
for line in fileob:
scriptname, name, start, stop = line.strip().split()
facilities.setdefault(name, {})[scriptname] = (int(start),
int(stop))
- except ValueError, x:
+ except ValueError as x:
print >> sys.stderr, 'Invalid facility line', line
return facilities
fh.close()
if __name__ == '__main__':
- print scan_initfile('init-fragment')
+ print (scan_initfile('init-fragment'))