def check_dependencies(): ostype = None if sys.version.rfind('Debian'): ostype = 'debian' (missing, extra) = gutils.get_dependencies() def __print_missing(modules): import string missing = '' for i in modules: if i['version'] == False or (not isinstance(i['version'], bool) and i['version'].startswith('-')): tmp = None if ostype is not None: if ostype == 'debian' and i.has_key('debian'): tmp = "\n%s package" % i['debian'] if i.has_key( 'debian_req') and i['debian_req'] is not None: tmp += "\n\tminimum required package version: %s" % i[ 'debian_req'] if tmp is None: tmp = "\n%s module" % i['module'] if i.has_key('module_req') and i['module_req'] is not None: tmp += "\n\tminimum required module version: %s" % i[ 'module_req'] if i.has_key('url'): tmp += "\n\tURL: %s" % i['url'] if i['version'] is not False and i['version'].startswith('-'): tmp += "\n\tavailable module version: %s" % i['version'][1:] if tmp is not None: missing += tmp if missing == '': return None else: return missing tmp = __print_missing(missing) if tmp is not None: print 'Dependencies missing:' print '====================' print tmp tmp = __print_missing(extra) if tmp is not None: print '\n\nOptional dependencies missing:' print '=============================' print tmp, "\n"
def check_dependencies(): ostype = None if sys.version.rfind('Debian'): ostype = 'debian' (missing, extra) = gutils.get_dependencies() def __print_missing(modules): missing = '' for i in modules: if i['version'] == False or (not isinstance(i['version'], bool) and i['version'].startswith('-')): tmp = None if ostype is not None: if ostype == 'debian' and i.has_key('debian'): tmp = "\n%s package" % i['debian'] if i.has_key( 'debian_req') and i['debian_req'] is not None: tmp += "\n\tminimum required package version: %s" % i[ 'debian_req'] if tmp is None: tmp = "\n%s module" % i['module'] if i.has_key('module_req') and i['module_req'] is not None: tmp += "\n\tminimum required module version: %s" % i[ 'module_req'] if i.has_key('url'): tmp += "\n\tURL: %s" % i['url'] if i['version'] is not False and i['version'].startswith('-'): tmp += "\n\tavailable module version: %s" % i['version'][1:] if tmp is not None: missing += tmp if not missing: return None else: return missing tmp = __print_missing(missing) if tmp: print 'Dependencies missing:' print '====================' print tmp tmp = __print_missing(extra) if tmp: print '\n\nOptional dependencies missing:' print '=============================' print tmp, "\n"
def check_dependencies(): ostype = None if sys.version.rfind("Debian"): ostype = "debian" (missing, extra) = gutils.get_dependencies() def __print_missing(modules): import string missing = "" for i in modules: if i["version"] == False or (not isinstance(i["version"], bool) and i["version"].startswith("-")): tmp = None if ostype is not None: if ostype == "debian" and i.has_key("debian"): tmp = "\n%s package" % i["debian"] if i.has_key("debian_req") and i["debian_req"] is not None: tmp += "\n\tminimum required package version: %s" % i["debian_req"] if tmp is None: tmp = "\n%s module" % i["module"] if i.has_key("module_req") and i["module_req"] is not None: tmp += "\n\tminimum required module version: %s" % i["module_req"] if i.has_key("url"): tmp += "\n\tURL: %s" % i["url"] if i["version"] is not False and i["version"].startswith("-"): tmp += "\n\tavailable module version: %s" % i["version"][1:] if tmp is not None: missing += tmp if missing == "": return None else: return missing tmp = __print_missing(missing) if tmp is not None: print "Dependencies missing:" print "====================" print tmp tmp = __print_missing(extra) if tmp is not None: print "\n\nOptional dependencies missing:" print "=============================" print tmp, "\n"
def show_dependencies(): (missing, extra) = gutils.get_dependencies() for i in missing: print "%(module)s :: %(version)s" % i for i in extra: print "%(module)s :: %(version)s" % i
# ================================ # Note: indentations with 4 spaces. This is how wxGlade likes to generate files... # ================================ # set the PATH import sys, os.path lib = os.path.abspath(os.path.join(os.path.dirname(sys.argv[0]), 'lib')) if os.path.isdir(lib): sys.path.append(lib) del lib # check dependencies from gutils import get_dependencies (required, extra) = get_dependencies() missing = [] for i in required: if i['version'] is False or (i['version'] is not True and i['version'][0] == '-'): missing.append(i) if len(missing) > 0: print 'Error: missing modules:' for i in missing: print "%(module)s" % i, if i.has_key('module_req'): print "\t:: required version: %(module_req)s" % i, if i['version'] is not False and i['version'][0] == '-': print "\t:: detected: %(version)s" % i print "\n", sys.exit(1) del missing