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

📄 module.py

📁 linux下的一款播放器
💻 PY
📖 第 1 页 / 共 2 页
字号:
            if item != '':                self.define_exclude_list.append(string.strip(item))    def set_attribute(self, attribute):        self.attributes[attribute]=1    def unset_attribute(self, attribute):        self.attributes[attribute]=0    def get_attribute(self, attribute):        return self.attributes.get(attribute)    def set_build_static(self, attribute_string = None):        """Set the build_static_flag to true, indicating the module        should be built with the "static" umake option, in addition        to being built with normal options."""        self.build_static_flag = 1    def set_build_static_only(self, attribute_string = None):        """Same as set_build_static, except the module should only be built        once with the static umake option."""        self.build_static_flag = 1        self.build_static_only_flag = 1    def set_build_dynamic_only(self, attribute_string = None):        """Same as set_build_static, except the module should only be built        once with the static umake option."""        self.build_static_flag = 0        self.build_static_only_flag = 0        self.build_dynamic_only_flag = 1    def set_build_number(self, attribute_string = None):        """Set the build number flag.  This is depricated."""        self.build_number_flag = 1    def set_version_file(self, attribute_string = None):        """Set the version_file_flag to true, indicating the module        has a version file which should be incremented on build farm        builds."""        self.version_file_flag  = 1    def set_update_platform_header(self, attribute_string = None):        """Set the update_platform_header to true, indicating the module        has a platform.h file which should be updated to reflect the        current build."""        self.update_platform_header_flag  = 1    def set_cvs_tag(self, cvs_tag, cvs_tag_type = None):        """Set this module to come from a given CVS tag, and indicate        if the tag is a CVS branch tag, or a normal CVS tag.  The        cvs_tag_type was once used to determine if updates to the version        files in the module could be checked into CVS by the automated        build farm."""        self.cvs_tag = string.strip(cvs_tag)        self.cvs_tag_flag = 1        ## set the tag type (branch/tag)        if not cvs_tag_type:            self.cvs_tag_type = 'branch'        elif string.lower(cvs_tag_type) == 'tag':            self.cvs_tag_type = 'tag'        elif string.lower(cvs_tag_type) == 'branch':            self.cvs_tag_type = 'branch'    def set_cvs_date(self, cvs_date):        """Set this module to come from a given CVS date"""        self.cvs_date = string.strip(cvs_date)        self.cvs_date_flag = 1    def set_cvs_root(self, cvs_root):        """Set what CVS repository to get this module from"""        self.cvs_root = cvs_root    def set_no_build(self, attribute_string = ''):        """Set the no_build_flag, indicating no action should be taken        on this module other than checking it out."""        self.no_build_flag = 1    def write(self, bif_data = None):        """Write the BIF XML for this module to standard output."""         line_list = []        # <module ....>        line_list.append('<!-- %s -->' % (string.upper(self.id)))        line = '<module id="%s"' % (self.id)        if self.id != self.name:            line = '%s name="%s"' % (line, self.name)        line = '%s group="%s"' % (line, self.group)        if self.type != self.MODULE_CVS:            line = '%s type="%s"' % (line, self.type)        if self.bif_version != 100:           line = '%s  version="%d.%02d"' % (line,                                             self.bif_version/100,                                             self.bif_version % 100)        line = '%s>' % (line)        line_list.append(line)        if self.filename != "-":            line_list.append('  <location file="%s" line="%d"/>' % (                self.filename,                self.line_number))        ## description        if len(self.description) > 0:            line_list.append('  <description>')            line_list.append('  %s' % (self.description))            line_list.append('  </description>')            line_list.append('')        if self.error_message:            line_list.append('  <checkout_error_message>')            line_list.append('  %s' % self.error_message)            line_list.append('  </checkout_error_message>')            line_list.append('')        addnl=0        defroot=None        deftag=None        deftagtype=None        defdate=None        if bif_data:            defroot=bif_data.default_cvs_root            deftag=bif_data.default_cvs_tag            deftagtype=bif_data.default_cvs_tag            defdate=bif_data.default_cvs_date        newstyle = 0        if self.cvs_root != defroot:            line_list.append('  <cvs root="%s"/>' % (self.cvs_root or ""))            newstyle = 1            addnl=1        if self.cvs_date != defdate:            line_list.append('  <cvs date="%s"/>' % (self.cvs_date or ""))            newstyle = 1            addnl=1        if self.cvs_path:            line_list.append('  <cvs path="%s"/>' % (self.cvs_path))            newstyle = 1            addnl=1        if self.default_profile:            line_list.append('  <default profile="%s"/>' %                             (self.default_profile))            addnl=1        if self.cvs_tag != deftag or self.cvs_tag_type != deftagtype:            if newstyle:                if self.cvs_tag_type == "branch":                    line_list.append('  <cvs branch="%s"/>' % (self.cvs_tag))                else:                    line_list.append('  <cvs tag="%s"/>' % (self.cvs_tag))            else:                line_list.append('  <cvstag id="%s" type="%s"/>' % (                    self.cvs_tag,                    self.cvs_tag_type))            addnl=1                    if self.default_options:            line_list.append('  <default options="%s"/>' %                             (self.default_options))            addnl=1        if addnl:            line_list.append("")        for s in self.sdks:            line_list.append(s.write())        if self.sdks:            line_list.append('')            # flags        if self.build_number_flag:            line_list.append('  <attribute id="build_number"/>')                    if self.version_file_flag:            line_list.append('  <attribute id="has_version_file"/>')        if self.update_platform_header_flag:            line_list.append('  <attribute id="update_platform_header"/>')        if self.build_static_flag and not self.build_static_only_flag:            line_list.append('  <attribute id="static_build"/>')        if self.build_static_only_flag and self.build_static_flag:            line_list.append('  <attribute id="static_build_only"/>')        if self.build_dynamic_only_flag:            line_list.append('  <attribute id="dynamic_build_only"/>')        if self.no_build_flag:            line_list.append('  <attribute id="no_build"/>')        for a in self.attributes.keys():            if self.attributes[a]:                line_list.append('  <attribute id="%s"/>' % a)        if string.find(line_list[-1], 'attribute'):            line_list.append('')        # includeplatforms        if self.platform_include_list_flag:            line_list.append('  <includeplatforms>')            line_list.append('    %s' % (string.join(self.platform_include_list)))            line_list.append('  </includeplatforms>')            line_list.append('')        # excludeplatforms        if self.platform_exclude_list_flag:            line_list.append('  <excludeplatforms>')            line_list.append('    %s' % (string.join(self.platform_exclude_list)))            line_list.append('  </excludeplatforms>')            line_list.append('')        # includeprofiles        if self.profile_include_list_flag:            line_list.append('  <includeprofiles>')            line_list.append('    %s' % (string.join(self.profile_include_list)))            line_list.append('  </includeprofiles>')            line_list.append('')        # excludeprofiles        if self.profile_exclude_list_flag:            line_list.append('  <excludeprofiles>')            line_list.append('    %s' % (string.join(self.profile_exclude_list)))            line_list.append('  </excludeprofiles>')            line_list.append('')        # includedefines        if self.define_include_list_flag:            line_list.append('  <ifdef>')            line_list.append('    %s' % (string.join(self.define_include_list)))            line_list.append('  </ifdef>')            line_list.append('')        # excludedefines        if self.define_exclude_list_flag:            line_list.append('  <ifndef>')            line_list.append('    %s' % (string.join(self.define_exclude_list)))            line_list.append('  </ifndef>')            line_list.append('')        if len(self.defines):            line_list.append("  <defines>")            for d in self.defines.keys():                line_list.append('    %s=%s' % (d, self.defines[d]))            line_list.append("  </defines>")        if len(self.umake_includefiles):            line_list.append("  <umake_includefiles>")            line_list.append('    %s' % (string.join(self.umake_includefiles)))            line_list.append("  </umake_includefiles>")        # dependancy list        if len(self.dependancy_id_list) > 0:            depend_list = []            for depend in self.dependancy_id_list:                depend_list.append(depend)                        line_list.append('  <dependlist>')            while (len(depend_list)):                line_list.append('    %s' % (string.join(depend_list[:5])))                depend_list = depend_list[5:]            line_list.append('  </dependlist>')        # dependancy list        if len(self.source_dependancy_id_list) > 0:            depend_list = []            for depend in self.source_dependancy_id_list:                depend_list.append(depend)                        line_list.append('  <source_dependlist>')            while (len(depend_list)):                line_list.append('    %s' % (string.join(depend_list[:5])))                depend_list = depend_list[5:]            line_list.append('  </source_dependlist>')        # dependancy list        if len(self.checkin_dependancy_id_list) > 0:            depend_list = []            for depend in self.checkin_dependancy_id_list:                depend_list.append(depend)                        line_list.append('  <checkin_dependlist>')            while (len(depend_list)):                line_list.append('    %s' % (string.join(depend_list[:5])))                depend_list = depend_list[5:]            line_list.append('  </checkin_dependlist>')        line_list.append('</module>')        return "    " + string.join(line_list,"\n    ") + "\n";        for line in line_list:            ret.append('    %s' % (line))    def path(self):        if '/' in self.name:            return apply(os.path.join, [os.curdir] + string.split(self.name,"/"))        else:            return self.name    def checkout(self,                 root=None,                 tag=None,                 date=None,                 as=None,  ## Native path                 nonrecursive = None,                 zap=None,                 download_only=None,                 system_id=None,                 profile=None,                 build_type=None):        import distributions        import cvs        import shell        try:            if self.checkin_dep_only:                return        except AttributeError:            pass        if self.type == "cvs":            distributions.setup()            tmpdir=distributions.tmpdir()            tmpdir=os.path.join(tmpdir,"module")            cvs.Checkout(tag or self.cvs_tag,                         self.cvs_path or self.name,                         root or self.cvs_root,                         tmpdir,                         date or self.cvs_date,                         nonrecursive,                         zap)            if ( ( tag or self.cvs_tag) and                 (date or self.cvs_date) and                 not os.path.exists(tmpdir) ):                                cvs.Checkout(self.cvs_tag,                             self.cvs_path or self.name,                             root or self.cvs_root,                             tmpdir,                             self.cvs_date,                             nonrecursive,                             zap)            if not os.path.exists(tmpdir):                raise cvs.cvs_error            shell.mkdir(os.path.dirname(as or self.path()))            os.rename(tmpdir, as or self.path())            distributions.cleanup()        elif self.type == "distribution":            df=distributions.DistFinder(self.name,                                        root or self.cvs_root,                                        tag or self.tag,                                        date or self.cvs_date)            fun = df.get_distribution            if download_only:                fun=df.download_distribution                if not system_id:                    system_id = sysinfo.id                return df.get_distribution(                    sysinfo.PLATFORM_HASH.get(system_id).distribution_id,                    profile,                    build_type)## entrypointsdef CreateModule(id, name = None, filename = None, line_number = None):    """Creates one instance of the Module class with the given id, and    optional CVS name, if it is different from the module id."""    return Module(id, name, filename, line_number)

⌨️ 快捷键说明

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