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

📄 buildapp.py

📁 linux下的一款播放器
💻 PY
📖 第 1 页 / 共 4 页
字号:
# # ***** BEGIN LICENSE BLOCK *****# Source last modified: $Id: buildapp.py,v 1.38 2004/11/12 21:05:31 hubbe Exp $# # Portions Copyright (c) 1995-2004 RealNetworks, Inc. All Rights Reserved.# # The contents of this file, and the files included with this file,# are subject to the current version of the RealNetworks Public# Source License (the "RPSL") available at# http://www.helixcommunity.org/content/rpsl unless you have licensed# the file under the current version of the RealNetworks Community# Source License (the "RCSL") available at# http://www.helixcommunity.org/content/rcsl, in which case the RCSL# will apply. You may also obtain the license terms directly from# RealNetworks.  You may not use this file except in compliance with# the RPSL or, if you have a valid RCSL with RealNetworks applicable# to this file, the RCSL.  Please see the applicable RPSL or RCSL for# the rights, obligations and limitations governing use of the# contents of the file.# # Alternatively, the contents of this file may be used under the# terms of the GNU General Public License Version 2 or later (the# "GPL") in which case the provisions of the GPL are applicable# instead of those above. If you wish to allow use of your version of# this file only under the terms of the GPL, and not to allow others# to use your version of this file under the terms of either the RPSL# or RCSL, indicate your decision by deleting the provisions above# and replace them with the notice and other provisions required by# the GPL. If you do not delete the provisions above, a recipient may# use your version of this file under the terms of any one of the# RPSL, the RCSL or the GPL.# # This file is part of the Helix DNA Technology. RealNetworks is the# developer of the Original Code and owns the copyrights in the# portions it created.# # This file, and the files included with this file, is distributed# and made available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY# KIND, EITHER EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS# ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET# ENJOYMENT OR NON-INFRINGEMENT.# # Technology Compatibility Kit Test Suite(s) Location:#    http://www.helixcommunity.org/content/tck# # Contributor(s):# # ***** END LICENSE BLOCK *****# """The main build system application class, BuildApp, lives here."""RCS_ID = '$Id: buildapp.py,v 1.38 2004/11/12 21:05:31 hubbe Exp $'import osimport sysimport stringimport timeimport reimport tracebackimport getoptimport posixpath## Macintosh stufftry:    import macfsexcept:    pass## our own stuffimport outputimport outmsgimport shellimport bldregimport sysinfoimport errimport stat#### begin entry points##def RunBuild(settings_list):    app = BuildApp(settings_list)    app.main()#### end entry points##VERSION = "2.3"OPTION_STRING = "klxvqfecCuynUhaom:d:t:s:r:j:p:P:D:"class BuildApp:    IDENT = 'Build System (V%s)' % VERSION    def __init__(self, settings_list):        ## the argument list        self.option_list, self.argument_list = \                          getopt.getopt(settings_list, OPTION_STRING)        ## the data file used for this build        self.build_xml_file = ''        ## by-name hash table of all modules in the        ## build data file, self.build_xml_file        self.module_hash = {}        ## hash table of settings        self.settings = {}        ## list of build choices, given on the command line        ## by -t debug,archive,bla1,bla2...  this is really        ## kind of a hack for getting additional information        ## to the build system without changing the remote        ## build system protocol        self.settings['build_options'] = []        ## name of code package to create if in archive mode        self.archive_filename = 'archive.rna'        ## where built targets get copied to        self.build_output_file = 'build.out'        self.build_branch = ''        self.build_type = 'debug'        self.skip_to_module = ''        self.archive_name = ''        self.full_archive_name = ''        ## cvs-tag information        self.everything_from_cvs_tag = ''        self.default_cvs_tag = ''        self.default_cvs_tag_type = ''        self.everything_from_cvs_date = ''        self.default_cvs_date = ''        self.default_cvs_root = ''        ## list of target ids buildapp was invoked with        self.target_id_list = []        ## object of type DependList formed from the combination        ## of targets in self.target_id_list        self.depends = None                # for Mac OS X uber project, we build a dependency dictionary with        # the build list of each module        if os.environ.get('BUILD_ON_PLATFORM','') == 'MacOSX':                self.module_id_build_dict = {}    def main(self):        self.setup_tasks()        self.run()        self.shutdown_tasks()    def setup_tasks(self):        ## setup outmsg callbacks for local filtering        outmsg.set_send_hook(self.send_cb)        outmsg.set_error_hook(self.error_cb)        outmsg.set_debug_hook(self.debug_cb)        outmsg.set_verbose_hook(self.verbose_cb)        self.parse_settings()    def shutdown_tasks(self):        ## remove output hooks        outmsg.set_send_hook(None)        outmsg.set_error_hook(None)        outmsg.set_debug_hook(None)        outmsg.set_verbose_hook(None)        ## remove output file        if self.output_name != '-':            if hasattr(sys.stdout, "RemoveOutputFile"):                sys.stdout.RemoveOutputFile(self.output_name)    def getopt_list(self, option):        list = []        for option_pair in self.option_list:            if option_pair[0] == option:                list.append(option_pair[1])        return list    def getopt_bool(self, option):        list = self.getopt_list(option)        ## returns a simple "true" for a option without arguments        if len(list):            return 1        return 0    def getopt_string(self, option):        list = self.getopt_list(option)        if not len(list):            return ''        return list[0]    def parse_settings(self):        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_make_copy_flag']=   self.getopt_bool('-l')        self.settings['no_cvs_checkout_flag']= self.getopt_bool('-k')        ## REQUIRED build branch argument        self.build_branch = self.getopt_string('-m')        ## PROFILE (overrieds PROFILE_ID)        profile = self.getopt_string("-P")        if profile:            os.environ["PROFILE_ID"]=profile        ## halt priority        halt_priority = self.getopt_string("-p")        if halt_priority not in ["", "red", "yellow", "green"]:            e = err.Error()            e.Set("The -p option requires one of three arguments: "\                  "red, yellow, or green.")            raise err.error, e        else:            self.settings['halt_priority'] = halt_priority        ## copy dir        copy_path = self.getopt_string('-d')        if self.getopt_string('-d'):            self.settings['copy_path'] = self.getopt_string('-d')        ## build_type {debug, release, ...} -> now build_options        ## to allow multiple options to the build system        build_options = self.getopt_list('-t')        ## special handling of the 'debug' and 'release' options        if build_options.count('debug'):            self.build_type = 'debug'            ## get rid of the conflicting option            while build_options.count('release'):                build_options.remove('release')        elif build_options.count('release'):            self.build_type = 'release'            ## get rid of the conflicting option            while build_options.count('debug'):                build_options.remove('debug')        else:            self.build_type = 'debug'            build_options.append('debug')        self.settings['build_options'] = build_options        ## skip to module        skip_to_module = self.getopt_string('-s')        if skip_to_module:            self.skip_to_module = skip_to_module        ## cvs tag        cvs_tag = self.getopt_string('-r')        if cvs_tag:            self.everything_from_cvs_tag = cvs_tag            self.default_cvs_tag = cvs_tag        ## cvs tag        cvs_date = self.getopt_string('-D')        if cvs_date:            self.everything_from_cvs_date = cvs_date            self.default_cvs_date = cvs_date        ## required arguments: target-list ...        self.target_id_list = self.argument_list        ## number of parallel "jobs" for GNU/parallel make        jobs = self.getopt_string("-j")        if jobs:            self.settings["make_jobs"] = jobs    def run(self):        ## save the base path & branch we're working out of in the registry        #if self.settings.get('umake_only_flag'):        #  bldreg.sync_off()        bldreg.set_value('build', 'path', os.getcwd())        bldreg.set_value('build', 'branch', self.build_branch)        ## set stdout/stderr output        self.set_output(self.build_output_file)        ## if there isn't a copy path defined, use the build type string as        ## the copy path        if not self.settings.get('copy_path'):            self.settings['copy_path'] = self.build_type        ## check for specified targets        if len(self.target_id_list) < 1:            e = err.Error()            e.Set("You need to specify a target to build.")            raise err.error, e        ## check for important environment variables and        ## remove some build system logging files        self.setup_build()        ## read the build information file, and create a        ## dependency list for the build targets

⌨️ 快捷键说明

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