Revert "Fix initdutils for Python 3 compatibility."
authorDidier Raboud <odyx@debian.org>
Mon, 5 Nov 2012 11:03:15 +0000 (12:03 +0100)
committerDidier Raboud <odyx@debian.org>
Mon, 5 Nov 2012 11:03:15 +0000 (12:03 +0100)
This reverts commit 2a5bb842665d68772dd45c1a25b43412737aa810.

debian/changelog
initdutils.py

index 2ff9467b4a49a04a603f20b52e0a942d34b2aa65..ae2b699aca7554f941f0882a05d93db9cbabefae 100644 (file)
@@ -1,9 +1,3 @@
-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
index 0451b185792ce5c259860d54955d892c71895afe..3b5bb107e947718f645a03cd2e9789727728b31d 100644 (file)
@@ -1,12 +1,13 @@
 # Support for scanning init scripts for LSB info
 
-import re, sys, os
-import pickle
+import re, sys, os, cStringIO
+import cPickle
 
 try:
-    from io import StringIO
-except ImportError:
-    from cStringIO import StringIO
+    assert True
+except:
+    True = 1
+    False = 0
 
 class RFC822Parser(dict):
     "A dictionary-like object."
@@ -14,14 +15,14 @@ class RFC822Parser(dict):
     
     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 = StringIO(strob)
+            fileob = cStringIO.StringIO(strob)
 
         key = None
         for line in fileob:
@@ -118,7 +119,7 @@ def load_facilities():
                 scriptname, name, start, stop = line.strip().split()
                 facilities.setdefault(name, {})[scriptname] = (int(start),
                                                                int(stop))
-            except ValueError as x:
+            except ValueError, x:
                 print >> sys.stderr, 'Invalid facility line', line
 
     return facilities
@@ -173,4 +174,4 @@ def save_lsbinstall_info(filemap):
     fh.close()
 
 if __name__ == '__main__':
-    print (scan_initfile('init-fragment'))
+    print scan_initfile('init-fragment')