Changeset 3570 for pykota/branches/1.26_fixes/checkdeps.py
- Timestamp:
- 07/17/13 22:08:37 (11 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/branches/1.26_fixes/checkdeps.py
r3133 r3570 1 1 #! /usr/bin/env python 2 # -*- coding: ISO-8859-15-*-2 # -*- coding: utf-8 -*- 3 3 # 4 4 # PyKota … … 16 16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 17 # GNU General Public License for more details. 18 # 18 # 19 19 # You should have received a copy of the GNU General Public License 20 20 # along with this program; if not, write to the Free Software … … 32 32 try : 33 33 exec "import %s" % module 34 except ImportError : 34 except ImportError : 35 35 return 0 36 else : 36 else : 37 37 return 1 38 38 39 39 def checkCommand(command) : 40 40 """Checks if a command is available or not.""" … … 43 43 input.close() 44 44 return result 45 45 46 46 def checkWithPrompt(prompt, module=None, command=None, helper=None) : 47 47 """Tells the user what will be checked, and asks him what to do if something is absent.""" … … 50 50 if command is not None : 51 51 result = checkCommand(command) 52 elif module is not None : 52 elif module is not None : 53 53 result = checkModule(module) 54 if result : 54 if result : 55 55 sys.stdout.write("OK\n") 56 else : 56 else : 57 57 sys.stdout.write("NO.\n") 58 58 sys.stderr.write("ERROR : %s not available !\n" % prompt) 59 59 sys.stdout.write("%s\n" % helper) 60 61 if __name__ == "__main__" : 60 61 if __name__ == "__main__" : 62 62 print "Checking PyKota dependencies..." 63 63 64 64 # checks if Python version is correct, we need >= 2.2 65 65 if not (sys.version > "2.2") : 66 66 sys.stderr.write("PyKota needs at least Python v2.2 !\nYour version seems to be older than that, please update.\nAborted !\n") 67 67 sys.exit(-1) 68 68 69 69 # checks if some needed Python modules are there or not. 70 70 modulestocheck = [ ("Python-PygreSQL", "pg", "PygreSQL is mandatory if you want to use PostgreSQL as the quota database backend.\nSee http://www.pygresql.org"), … … 78 78 ("Python-ReportLab", "reportlab.pdfgen.canvas", "Python-ReportLab is required if you plan to have PyKota generate banners.\nSee http://www.reportlab.org/"), 79 79 ("Python-Imaging", "PIL.Image", "Python-Imaging is required if you plan to have PyKota generate banners.\nSee http://www.pythonware.com/downloads/"), 80 ("Python-Psyco", "psyco", "Python-Psyco speeds up parsing of print files, you should use it.\nSee http://psyco.sourceforge.net/"),81 80 ("Python-pkpgcounter", "pkpgpdls", "Python-pkpgcounter is mandatory.\nGrab it from http://www.pykota.com/software/pkpgcounter/"), 82 81 ("Python-PAM", "PAM", "Python-PAM is recommended if you plan to use pknotify+PyKotIcon.\nGrab it from http://www.pangalactic.org/PyPAM/"), … … 85 84 ] 86 85 commandstocheck = [ ("GhostScript", "gs", "Depending on your configuration, GhostScript may be needed in different parts of PyKota."), 87 ("SNMP Tools", "snmpget", "SNMP Tools are needed if you want to use SNMP enabled printers."), 86 ("SNMP Tools", "snmpget", "SNMP Tools are needed if you want to use SNMP enabled printers."), 88 87 ("Netatalk", "pap", "Netatalk is needed if you want to use AppleTalk enabled printers.") 89 88 ] 90 89 for (name, module, helper) in modulestocheck : 91 90 checkWithPrompt(name, module=module, helper=helper) 92 91 93 92 # checks if some software are there or not. 94 93 for (name, command, helper) in commandstocheck : 95 94 checkWithPrompt(name, command=command, helper=helper) 96 95