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

📄 bif.py

📁 linux下的一款播放器
💻 PY
📖 第 1 页 / 共 3 页
字号:
        self.module.set_dependancy_id_list(data)            def handle_data_source_dependlist(self, data):        self.module.set_source_dependancy_id_list(data)    def handle_data_checkin_dependlist(self, data):        self.module.set_checkin_dependancy_id_list(data)            def handle_data_umake_includefiles(self, data):        self.module.umake_includefiles.extend(string.split(data))            def handle_data_defines(self, data):        for d in string.split(data):            val = "1"            ind = string.find(d, "=")            if ind != -1:                val = d[ind+1:]                d=d[:ind]            self.module.defines[d]=val    def handle_data_sdk(self, data):        self.module.sdks[-1].error_message = self.module.sdks[-1].error_message + data + "\r\n"            def handle_data_checkout_error_message(self, data):        self.module.error_message = self.module.error_message + data + "\r\n"    def handle_data_default(self, data):        self.warning("invalid data=\"%s\"" % (data))    def handle_data(self, data):        data = string.strip(data)        if not data:            return        self.__data_cb(data)    ## <build>    def start_build(self, attr):        self.push_tag(TAG_build)        try:            self.bif_data.set_build_id(attr['id'])        except KeyError:            self.error("<build> requires \"id\"")        try:            v = attr["version"]            v=string.split(v,".")            v=int(v[0])*100 + int(v[1])            self.bif_data.bif_version=v        except KeyError:            pass        try:            expires=attr['expires']            t=datelib.date_to_ticks(expires+" 00:00:00")            if t == None:                self.warning("Invalid expiration date (%s), using 2005-01-1" % repr(expires))                expires="2005-01-01"            elif time.time() > t:                self.warning("This BIF file has expired!")            elif time.time() + 30 * 24 * 60 * 60 > t:                self.warning("This BIF file will expire within a month")            elif time.time() + 3 * 365 * 24 * 60 * 60 < t:                self.warning("This expiration date is invalid, using 2005-01-01!!!")                expires="2005-01-01"        except KeyError:            self.warning("This BIF file lacks an expiration date, using 2005-01-01")            expires="2005-01-01"                    self.bif_data.expires=expires                    ## </build>    def end_build(self):        self.pop_tag(TAG_build)    def start_version(self, attr):        try:            v=attr['id']        except KeyError:            self.error("<version> requires \"id\"")        v=string.split(v,".")        v=int(v[0])*100 + int(v[1])        if self.current_tag == TAG_build:            self.bif_data.bif_version=v        elif self.current_tag == TAG_module:            self.module.bif_version=v        else:            self.error("<version> in wrong place")    def start_inherit(self, attr):        idtmp=self.bif_data.build_id        try:            tid = attr["id"]        except KeyError:            self.error("<inherit> requires \"id\"")        try:            v = attr["version"]            v=string.split(v,".")            v=int(v[0])*100 + int(v[1])            self.bif_data.bif_version=v        except KeyError:            pass                if not self.branchlist:            import branchlist            self.branchlist = branchlist.BranchList()                    file_name=self.branchlist.file(tid)        if not file_name:            self.error("Unable to find BIF file \"%s\" for inherit." % tid)        BIFParser(file_name, self.bif_data, self.branchlist)        for mod in self.bif_data.module_hash.values():            mod.inherited=1                        self.bif_data.build_id=idtmp    ## <sdk name="sdk_name" [ for="system_id_glob" ] [ path="default_path" ] [ ifexists="file or dir" ]/>    def start_sdk(self, attr):        self.push_tag(TAG_sdk)        self.module.sdks.append(            module.SDK(attr.get("name"),                       attr.get("path"),                       "",                       attr.get("for"),                       attr.get("ifexists")))    def end_sdk(self):        self.pop_tag(TAG_sdk)            ## <default [for="system_id_glob"] [profile=".."] [target=".."] [options=".."] />    def start_default(self, attr):        if self.current_tag != TAG_build:            self.error("<default> in wrong place")        self.bif_data.defaults.append(            Default(attr.get("profile"),                    attr.get("target"),                    attr.get("options"),                    attr.get("for")))                            if attr.has_key("for"):            if not fnmatch.fnmatch(sysinfo.id ,attr['for']):                match =1                for l in sysinfo.family_list:                    if fnmatch.fnmatch(l ,attr['for']):                        match=1                        break                if not match:                    return        if self.current_tag == TAG_module:            if attr.has_key("profile"):                self.module.default_profile = attr['profile']                            if attr.has_key("options"):                self.module.default_options = attr['options']        else:            if attr.has_key("profile"):                self.bif_data.default_profile = attr['profile']                            if attr.has_key("target"):                self.bif_data.default_target = attr['target']                    if attr.has_key("options"):                self.bif_data.default_options = attr['options']            ## <cvstag id="..."/>    def start_cvstag(self, attr):        try:            tid = attr["id"]        except KeyError:            self.error("<cvstag> requires \"id\"")        ## set global default CVS tag        if self.current_tag == TAG_build:            self.bif_data.set_default_cvs_tag(tid)            if attr.has_key('type'):                self.bif_data.set_default_cvs_tag_type(attr['type'])        ## set the CVS tag/type for module        elif self.current_tag == TAG_module:            if attr.has_key('type'):                self.module.set_cvs_tag(tid, attr['type'])            else:                self.module.set_cvs_tag(tid)        else:            self.error("<cvstag> in wrong place")    ## <cvs root="..." tag="..." branch="..." path="..." date="..."/>    def start_cvs(self, attr):        tid = None        type = None        root = None        path = None        date = None                try:            root = attr["root"]        except KeyError:            pass        try:            tid = attr["tag"]            type = "tag"        except KeyError:            pass        try:            tid = attr["branch"]            type = "branch"        except KeyError:            pass        try:            path = attr["path"]        except KeyError:            pass        try:            date = attr["date"]        except KeyError:            pass        if not root and tid == None and path == None and date == None:            self.error('<cvs> requires "root", "tag", "branch", "path" or "date"')                    ## set global default CVS tag        if self.current_tag == TAG_build:            if root:                self.bif_data.set_default_cvs_root(root)            if tid != None:                self.bif_data.set_default_cvs_tag(tid)                if type:                    self.bif_data.set_default_cvs_tag_type(type)            if path:                self.error("<cvs path=.../> in wrong place")            if date:                self.bif_data.default_cvs_date = date        ## set the CVS tag/type for module        elif self.current_tag == TAG_module:            if root:                self.module.set_cvs_root(root)            if tid != None:                if type:                    self.module.set_cvs_tag(tid, type)                else:                    self.module.set_cvs_tag(tid)            if path:                self.module.cvs_path = path            if date:                self.module.set_cvs_date(date)                        else:            self.error("<cvs> in wrong place")    ## <targets>    def start_targets(self, attr):        self.push_tag(TAG_targets)    ## </targets>    def end_targets(self):        self.pop_tag(TAG_targets)    ## <checkout_error_message>    def start_checkout_error_message(self, attr):        self.push_tag(TAG_errmsg)    ## </checkout_error_message>    def end_checkout_error_message(self):        self.pop_tag(TAG_errmsg)    def start_location(self, attr):        if attr.has_key("file"):            self.module.filename=attr['file']        if attr.has_key("line"):            self.module.line_number=int(attr['line'])## <module id="..." name="..." group="..." type="..." inherit="...">    def start_module(self, attr):        self.push_tag(TAG_module)        if attr.has_key('inherit'):            h=attr['inherit']            if not self.bif_data.module_hash.has_key(h):                self.error("Cannot find module to inherit: '%s'" % h)            self.module = copy.deepcopy(self.bif_data.module_hash[h])            self.module.inherited=0            self.module.filename=self.filename            self.module.line_number=self.linenum            if attr.has_key('id'):                self.module.id = attr['id']            if attr.has_key('name'):                self.module.name = attr['name']        else:            try:                mid = attr["id"]            except KeyError:                self.error("<module> requires \"id\"")            mname = None            if attr.has_key('name'):                mname = attr['name']            self.module = CreateModule(mid, mname, self.filename, self.linenum)            self.module.bif_version = self.bif_data.bif_version        try:            v = attr["version"]            v=string.split(v,".")            v=int(v[0])*100 + int(v[1])            self.module.bif_version=v        except KeyError:            pass        ## Bind root/date/tag from global defaults        if self.bif_data.default_cvs_tag_type:            self.module.set_cvs_tag(self.bif_data.default_cvs_tag,                                    self.bif_data.default_cvs_tag_type)        else:            self.module.set_cvs_tag(self.bif_data.default_cvs_tag)        if self.bif_data.default_cvs_date:            self.module.set_cvs_date(self.bif_data.default_cvs_date)        if self.bif_data.default_cvs_root:            self.module.set_cvs_root(self.bif_data.default_cvs_root)        if attr.has_key('group'):            self.module.set_group(attr['group'])        if attr.has_key('type'):            mtype = attr["type"]                        if mtype == 'distribution':                self.module.set_type(self.module.MODULE_DISTRIBUTION)            elif mtype == 'name_only':                self.module.set_type(self.module.MODULE_NAME_ONLY)            elif mtype == 'installer':                self.module.set_type(self.module.MODULE_INSTALLER)            elif mtype == 'profile':                self.module.set_type(self.module.MODULE_PROFILE)            else:                self.error("unsupported module type=\"%s\"" % (mtype))    ## </module>    def end_module(self):        self.pop_tag(TAG_module)        self.bif_data.add_module(self.module)        self.module = None    ## <description>    def start_description(self, attr):        self.push_tag(TAG_description)    ## </description>    def end_description(self):        self.pop_tag(TAG_description)    ## <attribute id="..."/>    def start_attribute(self, attr):        if self.current_tag != TAG_module:            self.error("<attribute> in wrong place")        try:            aid = attr["id"]        except KeyError:            self.error("<attribute> requires \"id\"")        if aid == 'build_number':            self.module.set_build_number()        elif aid == 'has_version_file':            self.module.set_version_file()        elif aid == 'update_platform_header':            self.module.set_update_platform_header()        elif aid == 'static_build':            self.module.set_build_static()        elif aid == 'static_build_only':            self.module.set_build_static_only()        elif aid == 'dynamic_build_only':            self.module.set_build_dynamic_only()        elif aid == 'no_build':            self.module.set_no_build()        else:            self.module.set_attribute(aid)            ## <halt priority="..."/>    def start_halt(self, attr):        if self.current_tag != TAG_module:            self.error("<halt> in wrong place")        try:            priority = attr["priority"]        except KeyError:            self.error("<halt> requires \"priority\"")        if priority not in ["red", "yellow", "green"]:            self.error("<halt priority=\"%s\"> invalid, must be: "\                       "red, yellow, green" % (prioriey))        self.module.set_halt_priority(priority)                ## <includeplatforms>    def start_includeplatforms(self, attr):        self.push_tag(TAG_includeplatforms)    ## </includeplatforms>    def end_includeplatforms(self):        self.pop_tag(TAG_includeplatforms)    ## <excludeplatforms>    def start_excludeplatforms(self, attr):        self.push_tag(TAG_excludeplatforms)    ## </excludeplatforms>    def end_excludeplatforms(self):        self.pop_tag(TAG_excludeplatforms)

⌨️ 快捷键说明

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