#!/usr/bin/python # ------------------------------------------------------------------------------ # usage: # print_missing_modules.py path # # args: # path path to Python script to check # # result: # prints a list of modules known to be missing from script checked. if no # modules are known to be missing, returns 0, else nonzero import modulefinder import sets import sys if sys.argv.__len__() != 2: print 'error: incorrect number of arguments'; sys.exit(1) script = sys.argv[1] f = modulefinder.ModuleFinder() # check the specified script f.run_script(script) # get the missing modules missing_modules = sets.Set(f.any_missing()) # these modules seem to be OK to be missing... ok_missing_modules = sets.Set(['Carbon.File', 'Carbon.Folder', 'Carbon.Folders', '_emx_link', 'ce', 'mac', 'nt', 'org.python.core', 'os.path', 'os2', 'riscos', 'riscosenviron', 'riscospath']) # remove modules form the set that are ok absent missing_modules = missing_modules.difference(ok_missing_modules) for i in missing_modules: print i; rv = missing_modules.__len__() if rv > 255: rv = 255 sys.exit(rv)