#! /usr/bin/env python # -*- coding: ISO-8859-15 -*- # PyKota Print Quota Quote sender # # PyKota - Print Quotas for CUPS and LPRng # # (c) 2003, 2004, 2005 Jerome Alet # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. # # $Id$ # # $Log$ # Revision 1.18 2005/01/17 08:44:24 jalet # Modified copyright years # # Revision 1.17 2004/11/12 23:46:44 jalet # Heavy work on pkbanner. Not finished yet though, but mostly works. # # Revision 1.16 2004/10/11 22:53:05 jalet # Postponed string interpolation to help message's output method # # Revision 1.15 2004/10/11 12:49:06 jalet # Renders help translatable # # Revision 1.14 2004/10/06 10:05:47 jalet # Minor changes to allow any PyKota administrator to launch enhanced versions # of the commands, and not only the root user. # # Revision 1.13 2004/07/01 19:56:42 jalet # Better dispatching of error messages # # Revision 1.12 2004/06/18 13:34:49 jalet # Now all tracebacks include PyKota's version number # # Revision 1.11 2004/06/07 18:43:40 jalet # Fixed over-verbose exits when displaying help or version number # # Revision 1.10 2004/06/03 21:50:34 jalet # Improved error logging. # crashrecipient directive added. # Now exports the job's size in bytes too. # # Revision 1.9 2004/05/21 20:53:34 jalet # Now pykotme doesn't spawn a new process anymore to compute job's size, but # use the PDLAnalyzer class directly # # Revision 1.8 2004/05/10 07:23:21 jalet # pykotme now uses pkpgcounter to compute the job's size. # # Revision 1.7 2004/01/12 22:43:40 jalet # New formula to compute a job's price # # Revision 1.6 2004/01/08 14:10:32 jalet # Copyright year changed. # # Revision 1.5 2003/10/09 21:25:25 jalet # Multiple printer names or wildcards can be passed on the command line # separated with commas. # Beta phase. # # Revision 1.4 2003/10/07 09:07:27 jalet # Character encoding added to please latest version of Python # # Revision 1.3 2003/07/29 20:55:17 jalet # 1.14 is out ! # # Revision 1.2 2003/07/25 10:41:29 jalet # Better documentation. # pykotme now displays the current user's account balance. # Some test changed in ldap module. # # Revision 1.1 2003/07/03 09:44:01 jalet # Now includes the pykotme utility # # # import sys import os import pwd from pykota.tool import PyKotaTool, PyKotaToolError, crashed, N_ from pykota.pdlanalyzer import PDLAnalyzer, PDLAnalyzerError __doc__ = N_("""pykotme v%s (c) 2003, 2004, 2005 C@LL - Conseil Internet & Logiciels Libres Gives print quotes to users. command line usage : pykotme [options] [files] options : -v | --version Prints pykotme's version number then exits. -h | --help Prints this message then exits. -P | --printer p Gives a quote for this printer only. Actually p can use wildcards characters to select only some printers. The default value is *, meaning all printers. You can specify several names or wildcards, by separating them with commas. examples : $ pykotme --printer apple file1.ps file2.ps This will give a print quote to the current user. The quote will show the price and size of a job consisting in file1.ps and file2.ps which would be sent to the apple printer. $ pykotme --printer apple,hplaser