[24406] in Source-Commits

home help back first fref pref prev next nref lref last post

/svn/athena r24001 - in trunk/debathena/config/printing-config: debian files/usr/bin

daemon@ATHENA.MIT.EDU (Geoffrey Thomas)
Fri Sep 11 15:43:54 2009

Date: Fri, 11 Sep 2009 15:43:44 -0400
From: Geoffrey Thomas <geofft@MIT.EDU>
Message-Id: <200909111943.n8BJhix4020498@drugstore.mit.edu>
To: source-commits@mit.edu
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Author: geofft
Date: 2009-09-11 15:43:43 -0400 (Fri, 11 Sep 2009)
New Revision: 24001

Modified:
   trunk/debathena/config/printing-config/debian/changelog
   trunk/debathena/config/printing-config/files/usr/bin/lpr.debathena
Log:
In printing-config:
  * Insert LPROPT at the beginning of the options, rather than after the
    first option (which may accidentally split an option and its arguments).
  * Fix some issues with transformations to the 'args' variable sticking
    around for a larger scope than they were intended to. This prevents
    LPROPT from being inserted if we fall back from lprng to cups.


Modified: trunk/debathena/config/printing-config/debian/changelog
===================================================================
--- trunk/debathena/config/printing-config/debian/changelog	2009-09-09 20:59:37 UTC (rev 24000)
+++ trunk/debathena/config/printing-config/debian/changelog	2009-09-11 19:43:43 UTC (rev 24001)
@@ -1,3 +1,13 @@
+debathena-printing-config (1.12) jaunty; urgency=low
+
+  * Insert LPROPT at the beginning of the options, rather than after the
+    first option (which may accidentally split an option and its arguments).
+  * Fix some issues with transformations to the 'args' variable sticking
+    around for a larger scope than they were intended to. This prevents
+    LPROPT from being inserted if we fall back from lprng to cups.
+
+ -- Geoffrey Thomas <geofft@mit.edu>  Fri, 11 Sep 2009 15:36:31 -0400
+
 debathena-printing-config (1.11) unstable; urgency=low
 
   * Treat lpr -z as a toggle flag, and set it by default. (Trac: #138)

Modified: trunk/debathena/config/printing-config/files/usr/bin/lpr.debathena
===================================================================
--- trunk/debathena/config/printing-config/files/usr/bin/lpr.debathena	2009-09-09 20:59:37 UTC (rev 24000)
+++ trunk/debathena/config/printing-config/files/usr/bin/lpr.debathena	2009-09-11 19:43:43 UTC (rev 24001)
@@ -18,7 +18,7 @@
 
 def lpropt_transform(args):
     if 'LPROPT' in os.environ:
-        args[1:1] = shlex.split(os.environ['LPROPT'])
+        return shlex.split(os.environ['LPROPT']) + args
     return args
 
 def zephyr_transform(options):
@@ -121,7 +121,7 @@
             if transformers:
                 (transform_args, transform_opts) = transformers
             else:
-                (transform_args, transform_opts) = (None, None)
+                transform_args = transform_opts = lambda x: x
         except KeyError:
             error(1, """
 Error: this script was called as %s, when it must be called as
@@ -130,22 +130,20 @@
 """ % command)
 
         # Attempt to parse it with the current version of this command
-        if transform_args:
-            args = transform_args(args)
+        targs = transform_args(args)
         try:
-            options, realargs = getopt.gnu_getopt(args, cmd_opts)
+            options, realargs = getopt.gnu_getopt(targs, cmd_opts)
         except getopt.GetoptError:
             # That's the wrong version, so try the next one.
             continue
 
-        if transform_opts:
-            options = transform_opts(options)
-        args = [o + a for o, a in options] + realargs
+        options = transform_opts(options)
+        ttargs = [o + a for o, a in options] + realargs
         for o, a in options:
             if o == '-P':
-                return (version, a, args)
+                return (version, a, ttargs)
         if command == 'cancel' and len(realargs) > 0:
-            return (version, realargs[0], args)
+            return (version, realargs[0], ttargs)
         # Since we've successfully getopt'd, don't try any other versions,
         # but do note that we like this version.
         preference = version


home help back first fref pref prev next nref lref last post