Changeset 1578 for pykota/trunk/bin

Show
Ignore:
Timestamp:
06/29/04 09:53:11 (20 years ago)
Author:
jalet
Message:

Improved pkhint

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/bin/pkhint

    r1546 r1578  
    2424# 
    2525# $Log$ 
     26# Revision 1.12  2004/06/29 07:53:11  jalet 
     27# Improved pkhint 
     28# 
    2629# Revision 1.11  2004/06/18 13:34:48  jalet 
    2730# Now all tracebacks include PyKota's version number 
     
    122125                '/bin/nc -w 2 %(printer)s %(port)s </usr/share/pykota/pagecount.pjl 2>/dev/null | /usr/bin/tail -2', \ 
    123126              ] 
    124  
     127               
    125128class PKHint(PyKotaTool) : 
    126129    """A class to autodetect the best accounting method for printers.""" 
     
    236239                            accounter = 'hardware(' + netpjlcommand + ')' 
    237240                            configuration.append((printer, accounter)) 
    238                 elif devicetype == "direct" :  
    239                     sys.stderr.write("Can't currently handle device %s for printer %s\n" % (device, printer)) 
    240                 elif devicetype == "serial" :  
    241                     sys.stderr.write("Can't currently handle device %s for printer %s\n" % (device, printer)) 
     241                        else :     
     242                            configuration.append((printer, "software(/usr/bin/pkpgcounter)")) 
     243                # elif devicetype == "direct" :  
     244                #    sys.stderr.write("Can't currently handle device %s for printer %s\n" % (device, printer)) 
     245                #elif devicetype == "serial" :  
     246                #    sys.stderr.write("Can't currently handle device %s for printer %s\n" % (device, printer)) 
     247                #else : 
     248                #    sys.stderr.write("Can't currently handle device %s for printer %s\n" % (device, printer)) 
    242249                else : 
    243                     sys.stderr.write("Can't currently handle device %s for printer %s\n" % (device, printer)) 
     250                    configuration.append((printer, "software(/usr/bin/pkpgcounter)")) 
    244251                     
    245252        if not configuration :             
     
    247254        else : 
    248255            print "\nPut the following lines into your /etc/pykota/pykota.conf file :\n" 
     256            print "# BEWARE : if software accounting is suggested, this doesn't mean" 
     257            print "# that hardware accounting wouldn't work, this only means that PyKota" 
     258            print "# wasn't able to autodetect which hardware accounting method to use." 
    249259            for (printer, accounter) in configuration : 
    250260                print "[%s]" % printer 
     
    254264if __name__ == "__main__" :  
    255265    sys.stderr.write("BEWARE : This tool doesn't support LPRng's printcap files yet.\n") 
    256     sys.stderr.write("This tool is currently highly experimental, so don't rely on it.\n") 
    257266    retcode = 0 
    258267    try :