[24352] in Source-Commits

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

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

daemon@ATHENA.MIT.EDU (Geoffrey Thomas)
Tue Aug 4 17:09:38 2009

Date: Tue, 4 Aug 2009 17:09:24 -0400
From: Geoffrey Thomas <geofft@MIT.EDU>
Message-Id: <200908042109.n74L9Owe016911@drugstore.mit.edu>
To: source-commits@mit.edu
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Author: geofft
Date: 2009-08-04 17:09:24 -0400 (Tue, 04 Aug 2009)
New Revision: 23950

Modified:
   trunk/debathena/config/printing-config/debian/changelog
   trunk/debathena/config/printing-config/files/usr/bin/lpr.debathena
Log:
In printing-config:
  * Support LPROPT for LPRng lpr (Trac: #285).
  * Be a little more robust if ATHENA_USER doesn't exist for some
    strange reason.


Modified: trunk/debathena/config/printing-config/debian/changelog
===================================================================
--- trunk/debathena/config/printing-config/debian/changelog	2009-08-04 05:08:05 UTC (rev 23949)
+++ trunk/debathena/config/printing-config/debian/changelog	2009-08-04 21:09:24 UTC (rev 23950)
@@ -1,3 +1,11 @@
+debathena-printing-config (1.9) unstable; urgency=low
+
+  * Support LPROPT for LPRng lpr (Trac: #285).
+  * Be a little more robust if ATHENA_USER doesn't exist for some
+    strange reason.
+
+ -- Geoffrey Thomas <geofft@mit.edu>  Tue, 04 Aug 2009 16:58:45 -0400
+
 debathena-printing-config (1.8) unstable; urgency=low
 
   * Add support for lpr -z for LPRng in the wrapper, by turning it into

Modified: trunk/debathena/config/printing-config/files/usr/bin/lpr.debathena
===================================================================
--- trunk/debathena/config/printing-config/files/usr/bin/lpr.debathena	2009-08-04 05:08:05 UTC (rev 23949)
+++ trunk/debathena/config/printing-config/files/usr/bin/lpr.debathena	2009-08-04 21:09:24 UTC (rev 23950)
@@ -12,12 +12,18 @@
 import hesiod
 import getopt
 import os
+import shlex
 import sys
 from subprocess import call, PIPE
 
+def lpropt_transform(args):
+    if 'LPROPT' in os.environ:
+        args[1:1] = shlex.split(os.environ['LPROPT'])
+    return args
+
 def zephyr_transform(options):
     def helper(o, a):
-        if o == '-z':
+        if o == '-z' and 'ATHENA_USER' in os.environ:
             return ('-m', 'zephyr%' + os.environ['ATHENA_USER'])
         return (o, a)
 
@@ -35,7 +41,8 @@
         'cancel': ('aAD:P:VU:', None),
         'lp': ('ckmprswBGYd:D:f:n:q:t:', None),
         'lpq': ('aAlLVcvP:st:D:', None),
-        'lpr': ('ABblC:D:F:Ghi:kJ:K:#:m:P:rR:sT:U:Vw:X:YZ:z1:2:3:4:', zephyr_transform),
+        'lpr': ('ABblC:D:F:Ghi:kJ:K:#:m:P:rR:sT:U:Vw:X:YZ:z1:2:3:4:',
+            (lpropt_transform, zephyr_transform)),
         'lprm': ('aAD:P:VU:', None),
     }
 }
@@ -104,7 +111,11 @@
         try:
             # Get the set of options that correspond to the command that this
             # script was invoked as
-            (cmd_opts, transform_opts) = opts[version][command]
+            (cmd_opts, transformers) = opts[version][command]
+            if transformers:
+                (transform_args, transform_opts) = transformers
+            else:
+                (transform_args, transform_opts) = (None, None)
         except KeyError:
             error(1, """
 Error: this script was called as %s, when it must be called as
@@ -113,6 +124,8 @@
 """ % command)
 
         # Attempt to parse it with the current version of this command
+        if transform_args:
+            args = transform_args(args)
         try:
             options, realargs = getopt.gnu_getopt(args, cmd_opts)
         except getopt.GetoptError:


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