Changeset 3413 for pykota/trunk/checkdeps.py
- Timestamp:
- 09/27/08 22:02:37 (16 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/checkdeps.py
r3411 r3413 11 11 # the Free Software Foundation, either version 3 of the License, or 12 12 # (at your option) any later version. 13 # 13 # 14 14 # This program is distributed in the hope that it will be useful, 15 15 # but WITHOUT ANY WARRANTY; without even the implied warranty of 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, see <http://www.gnu.org/licenses/>. … … 31 31 try : 32 32 exec "import %s" % module 33 except ImportError : 33 except ImportError : 34 34 return 0 35 else : 35 else : 36 36 return 1 37 37 38 38 def checkCommand(command) : 39 39 """Checks if a command is available or not.""" … … 42 42 input.close() 43 43 return result 44 44 45 45 def checkWithPrompt(prompt, module=None, command=None, helper=None) : 46 46 """Tells the user what will be checked, and asks him what to do if something is absent.""" … … 49 49 if command is not None : 50 50 result = checkCommand(command) 51 elif module is not None : 51 elif module is not None : 52 52 result = checkModule(module) 53 if result : 53 if result : 54 54 sys.stdout.write("OK\n") 55 else : 55 else : 56 56 sys.stdout.write("NO.\n") 57 57 sys.stderr.write("ERROR : %s not available !\n" % prompt) 58 58 sys.stdout.write("%s\n" % helper) 59 60 if __name__ == "__main__" : 59 60 if __name__ == "__main__" : 61 61 print "Checking PyKota dependencies..." 62 62 63 63 # checks if Python version is correct, we need >= 2.2 64 64 if not (sys.version > "2.2") : 65 65 sys.stderr.write("PyKota needs at least Python v2.2 !\nYour version seems to be older than that, please update.\nAborted !\n") 66 66 sys.exit(-1) 67 67 68 68 # checks if some needed Python modules are there or not. 69 69 modulestocheck = [ ("Python-PygreSQL", "pg", "PygreSQL is mandatory if you want to use PostgreSQL as the quota database backend.\nSee http://www.pygresql.org"), … … 83 83 ] 84 84 commandstocheck = [ ("GhostScript", "gs", "Depending on your configuration, GhostScript may be needed in different parts of PyKota."), 85 ("SNMP Tools", "snmpget", "SNMP Tools are needed if you want to use SNMP enabled printers."), 85 ("SNMP Tools", "snmpget", "SNMP Tools are needed if you want to use SNMP enabled printers."), 86 86 ("Netatalk", "pap", "Netatalk is needed if you want to use AppleTalk enabled printers.") 87 87 ] 88 88 for (name, module, helper) in modulestocheck : 89 89 checkWithPrompt(name, module=module, helper=helper) 90 90 91 91 # checks if some software are there or not. 92 92 for (name, command, helper) in commandstocheck : 93 93 checkWithPrompt(name, command=command, helper=helper) 94 94