⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dependlist.py

📁 linux下的一款播放器
💻 PY
📖 第 1 页 / 共 2 页
字号:
        ## Zero means it's required but not yet defined        if sdktmp[s.name] == 0:            #print "UNDEFINED SDK '%s', ask the trashpile..." % s.name            ## Man, this is going to be slow...            m=self.sdk_iterator(self.bif_data.module_hash.values(),                                self.find_sdk_module_iter,                                s.name, 1)            if not m:                m=self.sdk_iterator(self.bif_data.module_hash.values(),                                    self.find_sdk_module_iter,                                    s.name, 0)                            #print "Trashpile says: %s" % repr(m)            if m:                print "module[%s].deps+=%s" % (module.desc(), m)                module.dependancy_id_list.append(m)                module.source_dependancy_id_list.append(m)                self.bif_data.module_hash[m].set_attribute('sdk_depend_only')                sdktmp[0]=sdktmp[0]+1                sdktmp[s.name]="..."        return 0    def check_sdks_pass1(self):        sdktmp={}        # Find undefined SDKs        self.sdk_iterator(self.module_list,                          self.mark_sdk_iter,                          sdktmp)        sdktmp[0]=0        # Find modules which define those SDKs        self.sdk_iterator(self.module_list,                          self.add_sdk_dependencies_iter,                          sdktmp)        ## Return the number of dependencies that were added        return sdktmp[0]                        ## FIXME:    ##  1) Only print SDK warning messages once, even if there    ##     are multiple SDK tags    ##  2) If there are multiple SDK tags, but only one with a    ##     an error message, be sure to use that error message    def finalize_sdks_iter(self, module, s, sdktmp):        if sdktmp[s.name]:            sdk.SetPath(s.name, sdktmp[s.name])            return                sdep=None        try:            sdep=module.source_dep_only        except:            pass                if sdep:            return                print        print "=============================================="        print "Failed to find path to SDK named '%s'." % s.name        if s.error_message:            print            print s.error_message        else:            print "Please read documentation for instructions on"            print "how to obtain and install this SDK."                    print         print "See file://%s/doc/buildrc.html for more" % os.environ.get("BUILD_ROOT")        print "information about .buildrc files and SetSDKPath()."        print                 print "Your build will continue in 10 seconds, but "        print "will probably not complete successfully."        print "=============================================="        print        import time        time.sleep(10);    def check_sdks_pass2(self):        sdktmp={}        # Find all SDKs        self.sdk_iterator(self.module_list,                          self.mark_sdk_iter,                          sdktmp)        # Export SDK defines or print error if undefined        self.sdk_iterator(self.module_list,                          self.finalize_sdks_iter,                          sdktmp)                                ## used to determin platforms for include/exclude list    def chk_platform_list(self, platform_list, family_list):        for platform in platform_list:            if platform in family_list:                return 1        return 0    ## used to determin profiles for include/exclude list    def chk_profile_list(self, profile_list, profile):        import fnmatch        for p in profile_list:            if fnmatch.fnmatch(profile, p):                return 1        return 0    ## used to determin profiles for include/exclude list    def chk_define_list(self, define_list, defines):        for d in define_list:            if defines.has_key(d):                return 1        return 0    def chk_platform(self, module, fam = None, profile = None, defines = None):        if not fam:            fam = sysinfo.family_list        if module.platform_include_list_flag:            if not self.chk_platform_list(module.platform_include_list, fam):                return 0        if module.platform_exclude_list_flag:            if self.chk_platform_list(module.platform_exclude_list, fam):                return 0        if not profile:            profile=os.environ.get("PROFILE_ID","default")        profile=os.path.basename(profile)        if module.profile_include_list_flag:            if not self.chk_profile_list(module.profile_include_list, profile):                return 0        if module.profile_exclude_list_flag:            if self.chk_profile_list(module.profile_exclude_list, profile):                return 0        if not defines:            defines = self.defines        if module.define_include_list_flag:            if not self.chk_define_list(module.define_include_list, defines):                return 0        if module.define_exclude_list_flag:            if self.chk_define_list(module.define_exclude_list, defines):                return 0        return 1    ## compute a combined dependancy list given a list of targets    def compute_dependancy_list(self, target_list, ff = None):        mds = ModuleDependancyStack(self.bif_data, target_list, ff)        return mds.get_ordered_module_list()    def cvs_sublist(self, cvs_tag = None, default_flag = 0):        chk_func = lambda module: module.type == module.MODULE_CVS                module_name_list = []        for module in self.module_list:            if not chk_func(module):                continue                        ## if there was no cvs tag set, we want to continue            ## unless we are looking for the default modules            if not module.cvs_tag_flag and default_flag:                module_name_list.append(module.name)            elif module.cvs_tag == cvs_tag:                module_name_list.append(module.name)        return module_name_list    ## this is better than it use to be...    def get_sublist(self, chk_func, return_type, cvs_tag):        func = None        if return_type == "module":            func = lambda module: module        elif return_type == "id":            func = lambda module: module.id        elif return_type == "name":            func = lambda module: module.name        elif return_type == "path":            func = lambda module: module.path() ## func = module.Module.path  #less obvious-hubbe        sublist = []        for module in self.module_list:            ## Fix bug only for new BIFs            if module.bif_version >= 203:                if not self.chk_platform(module):                    continue                        if not chk_func(module):                continue                        if cvs_tag == None or module.cvs_tag == cvs_tag:                sublist.append(func(module))                        return sublist    def list(self, return_type = 'module', cvs_tag = None):        func = lambda module: 1        return self.get_sublist(func, return_type, cvs_tag)    ## the list of modules which are not distribution    ## modules and are not name-only modules    def checkout_list(self, return_type = 'module', cvs_tag = None):        func = lambda module: module.type == module.MODULE_CVS        return self.get_sublist(func, return_type, cvs_tag)    ## the list of modules which are distribution    ## modules and are not name-only modules    def distribution_list(self, return_type = 'module', cvs_tag = None):        def func(module, self = self):            if not self.chk_platform(module):                return 0            if module.type != module.MODULE_DISTRIBUTION:                return 0            return 1        return self.get_sublist(func, return_type, cvs_tag)    ## the list of modules which are distribution    ## modules and are not name-only modules    def version_file_list(self, return_type = 'module', cvs_tag = None):        func = lambda module: module.version_file_flag        return self.get_sublist(func, return_type, cvs_tag)    ## the list of modules which are not distribution    ## modules and are not name-only modules and are    ## no marked as 'no build' modules    def build_list(self, return_type = 'module', cvs_tag = None):        def func(module, self = self):            if module.type != module.MODULE_CVS:                return 0            if not self.chk_platform(module):                return 0            if module.no_build_flag:                return 0            return 1        return self.get_sublist(func, return_type, cvs_tag)    ## returns a list of the unique branches found in the list    def cvs_tag_list(self):        branch_list = []        for module in self.checkout_list():            if not module.cvs_tag_flag:                continue                        if not branch_list.count(module.cvs_tag):                branch_list.append(module.cvs_tag)        return branch_list## MAINif __name__ == '__main__':    import getopt    import bif    import buildmenu    buildmenu.call_buildrc()    focus = ''    xml=0    all=0        opt_list, arg_list = getopt.getopt(sys.argv[1:], 'apf:')    for opt in opt_list:        if opt[0] == '-f':            focus=opt[1]        if opt[0] == '-p':            xml=1        if opt[0] == '-a':            all=1    if len(arg_list) < 2:        print 'usage: python %s BIF target1 target2 ...' % (sys.argv[0])        sys.exit(1)    branch_name = arg_list[0]    target_list = arg_list[1:]    if not focus:        focus = target_list[0]    import branchlist    branch_list = branchlist.BranchList()    bif_filename = branch_list.file(branch_name)    ## load BIF file    bif_data = bif.load_bif_data(bif_filename)    depend_list = DependList(bif_data, target_list)    print '# TARGET LIST: %s' % (string.join(target_list))    print '# BIF FILE: %s' % (bif_filename)    print '# TOTAL TARGETS: %d' % (len(depend_list.list()))    print '# CHECKOUT TARGETS: %d' % (len(depend_list.checkout_list()))    print '# DISTRIBUTION TARGETS: %d' % (len(depend_list.distribution_list()))    def dump(module, ind, xtra=""):        if xml:            print module.write()            print        else:            attr=[]            if module.no_build_flag:                attr.append("NB")            if module.build_dynamic_only_flag:                attr.append("D")            if module.build_static_only_flag:                attr.append("S")            if module.build_static_flag:                attr.append("SD")            print "%s-%s(%s)%s" % (" |"*ind, module.id, string.join(attr,","),xtra)    def rdump(modid, modmap, done, indent=0):        if not modmap.has_key(modid):            return        module=bif_data.module_hash[modid];        if done.has_key(modid):            sys.stdout.write("<%4d> " % done[modid])            dump(module, indent)            if not all:                return        else:            mnum = len(done)+1            done[modid] = mnum            sys.stdout.write("[%4d] " % mnum)            dump(module, indent)        for i in modmap[modid]:            rdump(i, modmap, done, indent+1)    print "BUILD DEPEND TREE:"    dep={}    for m in depend_list.list():        dep[m.id]=m.dependancy_id_list    rdump(focus, dep, {})    print    print "REVERSE DEPEND TREE:"    dep={}    for m in depend_list.list():        dep[m.id]=[]        for i in m.dependancy_id_list:            dep[i]=[]            for m in depend_list.list():        for i in m.dependancy_id_list:            dep[i].append(m.id)    rdump(focus, dep, {})    print

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -