Changeset 1178 for pykota/trunk
- Timestamp:
- 11/12/03 10:33:35 (21 years ago)
- Location:
- pykota/trunk
- Files:
-
- 3 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/bin/cupspykota
r1177 r1178 24 24 # 25 25 # $Log$ 26 # Revision 1.2 2003/11/12 09:33:34 jalet 27 # New CUPS backend supports device enumeration 28 # 26 29 # Revision 1.1 2003/11/08 16:05:31 jalet 27 30 # CUPS backend added for people to experiment. … … 33 36 import os 34 37 import time 38 import cStringIO 39 import shlex 35 40 36 41 from pykota.tool import PyKotaTool, PyKotaToolError … … 225 230 # This is a CUPS backend, we should act and die like a CUPS backend 226 231 if len(sys.argv) == 1 : 227 print 'direct cupspykota "PyKota" "Print Quota and Accounting Backend"' 232 # we will execute each existing backend in device enumeration mode 233 # and generate their PyKota accounting counterpart 234 (directory, myname) = os.path.split(sys.argv[0]) 235 for backend in [os.path.join(directory, b) for b in os.listdir(directory) if os.path.isfile(os.path.join(directory, b)) and (b != myname)] : 236 answer = os.popen(backend, "r") 237 try : 238 devices = [line.strip() for line in answer.readlines()] 239 except : 240 devices = [] 241 status = answer.close() 242 if status is None : 243 for d in devices : 244 fdevice = cStringIO.StringIO("%s" % d) 245 tokenizer = shlex.shlex(fdevice) 246 tokenizer.wordchars = tokenizer.wordchars + r".:,?!~/\_$*-+={}[]()#" 247 arguments = [] 248 while 1 : 249 token = tokenizer.get_token() 250 if token : 251 arguments.append(token) 252 else : 253 break 254 fdevice.close() 255 (devicetype, device, name, fullname) = arguments 256 if name.startswith('"') and name.endswith('"') : 257 name = name[1:-1] 258 if fullname.startswith('"') and fullname.endswith('"') : 259 fullname = fullname[1:-1] 260 print '%s cupspykota:%s "PyKota+%s" "PyKota managed %s"' % (devicetype, device, name, fullname) 228 261 retcode = 0 229 262 elif len(sys.argv) not in (6, 7) : -
pykota/trunk/NEWS
r1177 r1178 22 22 PyKota NEWS : 23 23 24 - 1.16alpha5 : 25 26 - New CUPS backend supports device enumeration ! 27 This means that NO manual CUPS configuration has to 28 be done. All can now be done from CUPS web interface. 29 24 30 - 1.16alpha4 : 25 31 -
pykota/trunk/pykota/version.py
r1177 r1178 22 22 # 23 23 24 __version__ = "1.16alpha 4_unofficial"24 __version__ = "1.16alpha5_unofficial" 25 25 26 26 __doc__ = """PyKota : a complete Printing Quota Solution for CUPS and LPRng."""