[25742] in Source-Commits

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

/svn/athena r25209 - in trunk/debathena/config/printing-config: debathena/printing debian

daemon@ATHENA.MIT.EDU (Jonathan D Reed)
Thu Jun 30 21:54:15 2011

Date: Thu, 30 Jun 2011 21:54:09 -0400
From: Jonathan D Reed <jdreed@MIT.EDU>
Message-Id: <201107010154.p611s9DZ013853@drugstore.mit.edu>
To: source-commits@mit.edu
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Author: jdreed
Date: 2011-06-30 21:54:09 -0400 (Thu, 30 Jun 2011)
New Revision: 25209

Modified:
   trunk/debathena/config/printing-config/debathena/printing/simple.py
   trunk/debathena/config/printing-config/debian/changelog
Log:
In printing-config:
  * Deal with CUPS' lprm's stupid syntax (Trac: #720)


Modified: trunk/debathena/config/printing-config/debathena/printing/simple.py
===================================================================
--- trunk/debathena/config/printing-config/debathena/printing/simple.py	2011-06-30 20:09:43 UTC (rev 25208)
+++ trunk/debathena/config/printing-config/debathena/printing/simple.py	2011-07-01 01:54:09 UTC (rev 25209)
@@ -16,6 +16,15 @@
 
 def simple(command, optinfo, queue_opt, args):
     args.pop(0)
+    
+    # Sigh.  CUPS' lprm, in its infinite wisdom, accepts '-' as a
+    # specifier for 'all jobs', which doesn't work with any option
+    # parsing code, ever.  However, CUPS does require that it be the
+    # last argument, so check for it, and save it because parse_args
+    # will kill it
+    lprmdash=False
+    if (command == 'lprm') and len(args) and (args[-1] == '-'):
+        lprmdash=True
 
     queue = common.get_default_printer()
     try:
@@ -29,6 +38,7 @@
         # Now that we've sliced up the arguments, put them back
         # together
         args = [o + a for o, a in options] + arguments
+
     except ValueError:
         # parse_args returned None, so we learned nothing. We'll just
         # go with the default queue
@@ -47,4 +57,8 @@
     if server:
         os.environ['CUPS_SERVER'] = server
 
+    # And now add it back (see above)
+    if lprmdash and (system == common.SYSTEM_CUPS):
+        args.append('-')
+
     common.dispatch_command(system, command, args)

Modified: trunk/debathena/config/printing-config/debian/changelog
===================================================================
--- trunk/debathena/config/printing-config/debian/changelog	2011-06-30 20:09:43 UTC (rev 25208)
+++ trunk/debathena/config/printing-config/debian/changelog	2011-07-01 01:54:09 UTC (rev 25209)
@@ -5,8 +5,9 @@
 
   [ Jonathan Reed ]
   * No, really, don't barf on unexpected args (Trac: #719)
+  * Deal with CUPS' lprm's stupid syntax (Trac: #720)
 
- -- Jonathan Reed <jdreed@mit.edu>  Mon, 27 Jun 2011 15:18:22 -0400
+ -- Jonathan Reed <jdreed@mit.edu>  Thu, 30 Jun 2011 21:48:29 -0400
 
 debathena-printing-config (1.23.3) unstable; urgency=low
 


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