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

📄 buildapp.py

📁 linux下的一款播放器
💻 PY
📖 第 1 页 / 共 4 页
字号:
            filename = string.lower(filename)            if os.name == "mac" and filename[0]!=':' and filename[:2]!="./":                filaneme = ':' + filename            filename = os.path.normpath(filename)            return filename        umf=[]        bl = self.depends.build_list()        for m in bl:            um = os.path.join(m.name, "Umakefil")            lum=mangle(um)            #print "MANGLE: %s => %s" % (repr(lum) , repr(um))            mf = bldreg.get_value_default("makefile",lum,None)            if mf:                umf.append('project.AddSubModule(%s, %s)' %                           ( repr(um), repr(mf) ))        umf.append('ProjectTarget()')        ## Only write the file if need be        umakefil_data = string.join(umf,"\n")        try:            if open("Umakefil","r").read() == umakefil_data:                return        except IOError:            pass                open("Umakefil","w").write(string.join(umf,"\n"))    def collate_modules(self):        ## Write some stuff to the registry (we need this for *all* modules)        umake_includefiles=[]        for mod in self.depends.list():            id = string.lower(mod.id)            bldreg.set_value("bifmodule_type",id,mod.type)            bldreg.set_value("bifmodule_deplist",id,mod.dependancy_id_list)            bldreg.set_value("bifmodule_source_deplist",id,mod.source_dependancy_id_list)            bldreg.set_value("bifmodule_checkin_deplist",id,mod.checkin_dependancy_id_list)            bldreg.set_value("bifmodule_path_to_id",string.lower(mod.name),id)            bldreg.set_value("bifmodule_id_to_path",id,string.lower(mod.name))            umake_includefiles.extend(mod.umake_includefiles)        bldreg.set_value("umake","includefiles",umake_includefiles)        ## form list of modules we have to deal with        build_list = self.depends.build_list()        ## check if we need to skip to a module        if len(self.skip_to_module):            build_name_list = self.depends.build_list('name')            try:                index = build_name_list.index(self.skip_to_module)            except ValueError:                e = err.Error()                e.Set("Skip to module option for module=\"%s\", but "\                      "that module was not in the bif file." % (                    self.skip_to_module))                raise err.error, e            ## cut off all the modules up to the skip module            build_list = build_list[index:]        self.errors=0        self.built=0        for module in build_list:            if os.path.exists("killbuild"):                outmsg.error("Build killed by killfile!")                sys.exit(1)            self.collate_module(module)        ## Cross platform compatible buzzword compliant uber project generation        self.write_uber_umakefile()        import umake        reload(umake)        umake.Umake(self.settings["build_options"][:])    def sign(self):        """Scan the self.settings["copy_path"], and md5 sign all the        files in it.  Write the signatures to the md5_sign.txt file."""        import md5sign        try:            last_time=os.stat("md5_sign.txt")[stat.ST_MTIME]        except:            last_time=0        time_string = time.ctime(time.time())        copy_path = self.settings["copy_path"]        outmsg.send('Build Complete: %s' % (time_string))        if not os.path.isdir(copy_path):            outmsg.send("copy path=\"%s\" not found" % (copy_path))        try:            file_list = os.listdir(copy_path)        except os.error:            e = err.Error()            e.Set("Cannot list directory=\"%s\"." % (copy_path))            raise err.error, e        try:            fil = open("md5_sign.txt", "a")        except IOError:            e = err.Error()            e.Set("Unable to open md5_sign.txt for writing.")            raise err.error, e        file_list.sort()        for file in file_list:            path = os.path.join(copy_path, file)            if os.path.exists(path) and \                   os.stat(path)[stat.ST_MTIME] >= last_time:                if os.path.isfile(path):                    text = md5sign.md5_fingerprint(path)                else:                    text = "DIR (%s)" % path                outmsg.send(text)                fil.write("%s\n" % (text))                            fil.close()    def archive_build(self):        ## name the output package        archive_filename = self.archive_filename        ## remove archive file if it exists        if os.path.isfile(archive_filename):            outmesg.send('removing old archive %s' % (archive_filename))            try:                os.remove(archive_filename)            except os.error:                outmsg.send('failed to remove %s' % (archive_filename))        outmsg.send('archiving build to %s' % (archive_filename))        ## form a list of contents of this build        archive_path_list = os.listdir(os.getcwd())        ## remove build.out from archive        if archive_path_list.count('build.out'):            archive_path_list.remove('build.out')        else:            outmsg.error('no build.out file found')        ## remove the copy path from the archive        if archive_path_list.count(self.settings['copy_path']):            archive_path_list.remove(self.settings['copy_path'])        else:            outmsg.error('no copy path %s file found' % (                self.settings['copy_path']))        ## omit the 'OBJS' directory from each module        real_path_list = []        for path in archive_path_list:            if os.path.isdir(path):                for file in os.listdir(path):                    if file != 'OBJS':                        real_path_list.append(os.path.join(path, file))            else:                real_path_list.append(path)        ## display the list of paths being archived and create archive        for path in real_path_list:            outmsg.send(path)        import archive        archive.Archive(archive_filename, real_path_list)        ## get the size of the archive for reporting        filehandle = open(archive_filename, 'r')        filehandle.seek(0, 2)        ## convert size to MB        size = filehandle.tell() / 1048576        filehandle.close()        outmsg.send("file=\"%s\" size=\"%dMB\"" % (archive_filename, size))    def build_info(self):        outmsg.send('\n' + self.IDENT)        outmsg.send('time: %s' % (time.ctime(time.time())))        outmsg.send('outfile: %s' % (self.output_name))        outmsg.send('branch: %s' % (self.build_branch))        outmsg.send('platform: %s' % (sysinfo.id))        outmsg.send('distribution/archive from: %s' % (sysinfo.distribution_id))        outmsg.send('build Type: %s' % (self.build_type))        outmsg.send('build options: %s' % (            string.join(self.settings['build_options'], ', ')))        outmsg.send('profile: %s' % bldreg.get_value("build","profile"))        if self.default_cvs_tag:            outmsg.send('cvs revision: %s' % (self.default_cvs_tag))        if self.default_cvs_date:            outmsg.send('cvs timestamp: %s' % (self.default_cvs_date))        if self.settings.get('copy_path'):            outmsg.send('copy target: %s' % (self.settings['copy_path']))        if self.settings.get('archive_build_flag'):            outmsg.send('archive build mode')        if self.settings.get('clean_mode_flag'):            outmsg.send('clean mode')        if self.settings.get('clobber_mode_flag'):            outmsg.send('clobber mode')        if self.settings.get('checkout_only_mode_flag'):            outmsg.send('checkout mode')        if self.settings.get('quiet_mode_flag'):            outmsg.send('quiet mode')        if self.settings.get('update_mode_flag'):            outmsg.send('update mode')        if self.settings.get('verbose_mode_flag'):            outmsg.send('verbose mode')        if self.settings.get('yes_mode_flag'):            outmsg.send('non-interactive mode')        if self.settings.get('no_make_depend_flag'):            outmsg.send('no makedepend mode')        if self.settings.get('no_umake_mode_flag'):            outmsg.send('no umake mode')        if self.settings.get('umake_only_flag'):            outmsg.send('only run umake')        if self.settings.get('no_compile_flag'):            outmsg.send('no compile mode')        if self.settings.get('no_cvs_checkout_flag'):            outmsg.send('no cvs checkout mode')        if self.settings.get('no_make_copy_flag'):            outmsg.send('no make copy mode')        self.settings['verbose_mode_flag']  = self.getopt_bool('-v')        self.settings['quiet_mode_flag']    = self.getopt_bool('-q')        self.settings['clean_mode_flag']    = self.getopt_bool('-c')        self.settings['clobber_mode_flag']  = self.getopt_bool('-C')        self.settings['update_mode_flag']   = self.getopt_bool('-u')        self.settings['yes_mode_flag']      = self.getopt_bool('-y')        self.settings['no_umake_mode_flag'] = self.getopt_bool('-n')        self.settings['umake_only_flag']    = self.getopt_bool('-U')        self.settings['checkout_only_flag'] = self.getopt_bool('-h')        self.settings['archive_build_flag'] = self.getopt_bool('-a')        self.settings['no_compile_flag']    = self.getopt_bool('-o')        self.settings['no_make_depend_flag']= self.getopt_bool('-e')        self.settings['no_cvs_checkout_flag']= self.getopt_bool('-k')        outmsg.send('target(s): %s' % (string.join(self.target_id_list)))        ## This will print the version of the compiler and other such things        import umake        reload(umake)        umake.Umake( ["__print_version_and_exit__"] )                outmsg.send('')    ## output handling    def set_output(self, default = None):        filename = default or self.build_output_file or '-'        if filename == '-':            self.output_name = '<stdout>'        else:            self.output_name = filename            ## remove old backup output file            try:                os.unlink('%s.bkp' % (self.output_name))            except os.error:                pass            ## move most recent to backup            try:                os.rename(self.output_name, '%s.bkp' % (self.output_name))            except os.error:                pass            ## add the file as a output destination            if hasattr(sys.stdout, "AddOutputFile"):                sys.stdout.AddOutputFile(self.output_name)            ## set the file/creator type on the Macintosh so it opens in            ## CodeWarrior IDE instead of SimpleText            if sysinfo.platform == "mac":                fsp = macfs.FSSpec(self.output_name)                fsp.SetCreatorType('CWIE', 'TEXT')    ## all outmsg hook callbacks    def send_cb(self, text):        if self.settings.get('quiet_mode_flag'):            return        print text    def error_cb(self, text):        print text    def debug_cb(self, text):        print text    def verbose_cb(self, text):        if self.settings.get('quiet_mode_flag'):            return        if self.settings.get('verbose_mode_flag'):            print text        else:            if hasattr(sys.stdout, "Block"):                sys.stdout.Block()                print text                sys.stdout.UnBlock()

⌨️ 快捷键说明

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