def post_init(self): """TODO remove this method, ugh""" self.cachedir = os.path.join(self.bldnode.abspath(), Build.CACHE_DIR) path = os.path.join(self.bldnode.abspath(), WAF_CONFIG_LOG) self.logger = Logs.make_logger(path, 'cfg') """ import logging logger = logging.getLogger('cfg') hdlr = logging.FileHandler(path, 'w') formatter = logging.Formatter('%(message)s') hdlr.setFormatter(formatter) logger.addHandler(hdlr) logger.setLevel(logging.INFO) self.logger = logger """ app = getattr(Context.g_module, 'APPNAME', '') if app: ver = getattr(Context.g_module, 'VERSION', '') if ver: app = "%s (%s)" % (app, ver) now = time.ctime() pyver = sys.hexversion systype = sys.platform args = " ".join(sys.argv) wafver = Context.WAFVERSION abi = Context.ABI self.to_log(conf_template % vars())
def execute(self): """ See :py:func:`waflib.Context.Context.execute` """ self.init_dirs() self.cachedir = self.bldnode.make_node(Build.CACHE_DIR) self.cachedir.mkdir() path = os.path.join(self.bldnode.abspath(), WAF_CONFIG_LOG) self.logger = Logs.make_logger(path, 'cfg') app = getattr(Context.g_module, 'APPNAME', '') if app: ver = getattr(Context.g_module, 'VERSION', '') if ver: app = "%s (%s)" % (app, ver) params = {'now': time.ctime(), 'pyver': sys.hexversion, 'systype': sys.platform, 'args': " ".join(sys.argv), 'wafver': Context.WAFVERSION, 'abi': Context.ABI, 'app': app} self.to_log(conf_template % params) self.msg('Setting top to', self.srcnode.abspath()) self.msg('Setting out to', self.bldnode.abspath()) if id(self.srcnode) == id(self.bldnode): Logs.warn('Setting top == out') elif id(self.path) != id(self.srcnode): if self.srcnode.is_child_of(self.path): Logs.warn('Are you certain that you do not want to set top="." ?') super(ConfigurationContext, self).execute() self.store() Context.top_dir = self.srcnode.abspath() Context.out_dir = self.bldnode.abspath() # this will write a configure lock so that subsequent builds will # consider the current path as the root directory (see prepare_impl). # to remove: use 'waf distclean' env = ConfigSet.ConfigSet() env.argv = sys.argv env.options = Options.options.__dict__ env.config_cmd = self.cmd env.run_dir = Context.run_dir env.top_dir = Context.top_dir env.out_dir = Context.out_dir # conf.hash & conf.files hold wscript files paths and hash # (used only by Configure.autoconfig) env.hash = self.hash env.files = self.files env.environ = dict(self.environ) if not (self.env.NO_LOCK_IN_RUN or env.environ.get('NO_LOCK_IN_RUN') or getattr(Options.options, 'no_lock_in_run')): env.store(os.path.join(Context.run_dir, Options.lockfile)) if not (self.env.NO_LOCK_IN_TOP or env.environ.get('NO_LOCK_IN_TOP') or getattr(Options.options, 'no_lock_in_top')): env.store(os.path.join(Context.top_dir, Options.lockfile)) if not (self.env.NO_LOCK_IN_OUT or env.environ.get('NO_LOCK_IN_OUT') or getattr(Options.options, 'no_lock_in_out')): env.store(os.path.join(Context.out_dir, Options.lockfile))
def __init__(self, global_context, cmd_argv, options_context, pkg, run_node): super(ConfigureWafContext, self).__init__(global_context, cmd_argv, options_context, pkg, run_node) run_path = self.run_node.abspath() source_path = self.top_node.abspath() build_path = self.build_node.abspath() _init(run_path=run_path, source_path=source_path, build_path=build_path) opts = OptionsContext() opts.load("compiler_c") opts.load("custom_python", tooldir=[WAF_TOOLDIR]) opts.parse_args([]) self.waf_options_context = opts waf_context = create_context("configure", run_dir=source_path) waf_context.options = Options.options waf_context.init_dirs() waf_context.cachedir = waf_context.bldnode.make_node(Build.CACHE_DIR) waf_context.cachedir.mkdir() path = os.path.join(waf_context.bldnode.abspath(), WAF_CONFIG_LOG) waf_context.logger = Logs.make_logger(path, 'cfg') self.waf_context = waf_context self._old_path = None
def execute(self): """ See :py:func:`waflib.Context.Context.execute` """ self.init_dirs() self.cachedir = self.bldnode.make_node(Build.CACHE_DIR) self.cachedir.mkdir() path = os.path.join(self.bldnode.abspath(), WAF_CONFIG_LOG) self.logger = Logs.make_logger(path, 'cfg') app = getattr(Context.g_module, 'APPNAME', '') if app: ver = getattr(Context.g_module, 'VERSION', '') if ver: app = "%s (%s)" % (app, ver) params = {'now': time.ctime(), 'pyver': sys.hexversion, 'systype': sys.platform, 'args': " ".join(sys.argv), 'wafver': Context.WAFVERSION, 'abi': Context.ABI, 'app': app} self.to_log(conf_template % params) self.msg('Setting top to', self.srcnode.abspath()) self.msg('Setting out to', self.bldnode.abspath()) if id(self.srcnode) == id(self.bldnode): Logs.warn('Setting top == out') elif id(self.path) != id(self.srcnode): if self.srcnode.is_child_of(self.path): Logs.warn('Are you certain that you do not want to set top="." ?') super(ConfigurationContext, self).execute() self.store() Context.top_dir = self.srcnode.abspath() Context.out_dir = self.bldnode.abspath() # this will write a configure lock so that subsequent builds will # consider the current path as the root directory (see prepare_impl). # to remove: use 'waf distclean' env = ConfigSet.ConfigSet() env.argv = sys.argv env.options = Options.options.__dict__ env.config_cmd = self.cmd env.run_dir = Context.run_dir env.top_dir = Context.top_dir env.out_dir = Context.out_dir # conf.hash & conf.files hold wscript files paths and hash # (used only by Configure.autoconfig) env.hash = self.hash env.files = self.files env.environ = dict(self.environ) if not self.env.NO_LOCK_IN_RUN and not getattr(Options.options, 'no_lock_in_run'): env.store(os.path.join(Context.run_dir, Options.lockfile)) if not self.env.NO_LOCK_IN_TOP and not getattr(Options.options, 'no_lock_in_top'): env.store(os.path.join(Context.top_dir, Options.lockfile)) if not self.env.NO_LOCK_IN_OUT and not getattr(Options.options, 'no_lock_in_out'): env.store(os.path.join(Context.out_dir, Options.lockfile))
def execute(self): """See Context.prepare""" self.init_dirs() self.cachedir = self.bldnode.make_node(Build.CACHE_DIR) self.cachedir.mkdir() path = os.path.join(self.bldnode.abspath(), WAF_CONFIG_LOG) self.logger = Logs.make_logger(path, 'cfg') app = getattr(Context.g_module, 'APPNAME', '') if app: ver = getattr(Context.g_module, 'VERSION', '') if ver: app = "%s (%s)" % (app, ver) now = time.ctime() pyver = sys.hexversion systype = sys.platform args = " ".join(sys.argv) wafver = Context.WAFVERSION abi = Context.ABI self.to_log(conf_template % vars()) self.msg('Setting top to', self.srcnode.abspath()) self.msg('Setting out to', self.bldnode.abspath()) if id(self.srcnode) == id(self.bldnode): Logs.warn('setting top == out') elif id(self.path) != id(self.srcnode): if self.srcnode.is_child_of(self.path): Logs.warn('Using an uncommon top directory') super(ConfigurationContext, self).execute() self.store() Context.top_dir = self.srcnode.abspath() Context.out_dir = self.bldnode.abspath() # this will write a configure lock so that subsequent builds will # consider the current path as the root directory (see prepare_impl). # to remove: use 'waf distclean' env = ConfigSet.ConfigSet() env['argv'] = sys.argv env['options'] = Options.options.__dict__ env.run_dir = Context.run_dir env.top_dir = Context.top_dir env.out_dir = Context.out_dir # conf.hash & conf.files hold wscript files paths and hash # (used only by Configure.autoconfig) env['hash'] = self.hash env['files'] = self.files env['environ'] = dict(self.environ) env.store(Context.run_dir + os.sep + Options.lockfile) env.store(Context.top_dir + os.sep + Options.lockfile) env.store(Context.out_dir + os.sep + Options.lockfile)
def execute(self): super(TestContext, self).execute() log_path = os.path.join(Context.top_dir, Context.out_dir, "test.log") self.logger = Logs.make_logger(log_path, "test") test_cases = [] cases = set( fnmatch.filter(self.test_cases.keys(), self.options.test_filter)) if not cases: self.fatal("no tests found: %s\n" % pattern) for case in cases: test_cases.append(self.test_cases[case]) test_cases.sort(key=lambda case: case.target) failures = 0 for case in test_cases: self.start_msg("Testing %s" % case.target) case_time = Timer() with tempfile.NamedTemporaryFile() as log: try: case.execute(self, log) self.end_msg("passed (%s)" % case_time, "GREEN") except AssertionError as e: self.to_log(str(e)) self.to_log(open(log.name).read()) self.end_msg("failed (%s)" % case_time, "RED") failures += 1
def execute(self): super(TestContext, self).execute() log_path = os.path.join(Context.top_dir, Context.out_dir, "test.log") self.logger = Logs.make_logger(log_path, "test") test_cases = [] cases = set(fnmatch.filter(self.test_cases.keys(), self.options.test_filter)) if not cases: self.fatal("no tests found: %s\n" % pattern) for case in cases: test_cases.append(self.test_cases[case]) test_cases.sort(key=lambda case: case.target) failures = 0 for case in test_cases: self.start_msg("Testing %s" % case.target) case_time = Timer() with tempfile.NamedTemporaryFile() as log: try: case.execute(self, log) self.end_msg("passed (%s)" % case_time, "GREEN") except AssertionError as e: self.to_log(str(e)) self.to_log(open(log.name).read()) self.end_msg("failed (%s)" % case_time, "RED") failures += 1 if failures == 1: self.fatal("1 test failed") elif failures > 1: self.fatal("%d tests failed" % failures)
def execute(self): self.init_dirs() self.cachedir = self.bldnode.make_node(Build.CACHE_DIR) self.cachedir.mkdir() path = os.path.join(self.bldnode.abspath(), WAF_CONFIG_LOG) self.logger = Logs.make_logger(path, 'cfg') app = getattr(Context.g_module, 'APPNAME', '') if app: ver = getattr(Context.g_module, 'VERSION', '') if ver: app = "%s (%s)" % (app, ver) params = { 'now': time.ctime(), 'pyver': sys.hexversion, 'systype': sys.platform, 'args': " ".join(sys.argv), 'wafver': Context.WAFVERSION, 'abi': Context.ABI, 'app': app } self.to_log(conf_template % params) self.msg('Setting top to', self.srcnode.abspath()) self.msg('Setting out to', self.bldnode.abspath()) if id(self.srcnode) == id(self.bldnode): Logs.warn('Setting top == out') elif id(self.path) != id(self.srcnode): if self.srcnode.is_child_of(self.path): Logs.warn( 'Are you certain that you do not want to set top="." ?') super(ConfigurationContext, self).execute() self.store() Context.top_dir = self.srcnode.abspath() Context.out_dir = self.bldnode.abspath() env = ConfigSet.ConfigSet() env.argv = sys.argv env.options = Options.options.__dict__ env.config_cmd = self.cmd env.run_dir = Context.run_dir env.top_dir = Context.top_dir env.out_dir = Context.out_dir env.hash = self.hash env.files = self.files env.environ = dict(self.environ) env.launch_dir = Context.launch_dir if not (self.env.NO_LOCK_IN_RUN or env.environ.get('NO_LOCK_IN_RUN') or getattr(Options.options, 'no_lock_in_run')): env.store(os.path.join(Context.run_dir, Options.lockfile)) if not (self.env.NO_LOCK_IN_TOP or env.environ.get('NO_LOCK_IN_TOP') or getattr(Options.options, 'no_lock_in_top')): env.store(os.path.join(Context.top_dir, Options.lockfile)) if not (self.env.NO_LOCK_IN_OUT or env.environ.get('NO_LOCK_IN_OUT') or getattr(Options.options, 'no_lock_in_out')): env.store(os.path.join(Context.out_dir, Options.lockfile))
def benchmarks_format_output(bch): from waflib import Logs logfile = os.path.join(bch.bldnode.abspath(), "benchmarks.log") bch.logger = Logs.make_logger(logfile, "benchmarks") def compute_score(data): S = 0.0 prev_elt = None for d in data: eps = d["eps"] time = d["time"] if not prev_elt is None: prev_eps, prev_time = prev_elt log10_eps = -math.log10(eps) prev_log10_eps = -math.log10(prev_eps) S += (log10_eps - prev_log10_eps) * (time + prev_time) / 2 prev_elt = (eps, time) return S #if bch.options.BENCHS_CMP_TO: # cmpdata = parse_results_file (bch.options.BENCHS_CMP_TO) cmpdata = {} D = getattr(bch, 'bench_results', {}) for benchs_name, benchs_data_dict in sorted(D.items(), key=lambda x: x[0]): bch.msg("===== %s =====" % benchs_name, "==========", color="NORMAL") for f, data in sorted(benchs_data_dict.items(), key=lambda x: x[0]): bch.start_msg(f) n = len(data) S = compute_score(data) msg = "%d measure%s, Score = %g" % (n, "s" if n > 1 else "", S) color = "CYAN" cmpS, _ = cmpdata.get(f, (None, None)) if cmpS: percent = 100. * (S / cmpS - 1.) msg += " (%0.2f%%)" % percent if percent <= 0: color = "GREEN" elif percent >= 2.5: color = "RED" else: color = "YELLOW" bch.end_msg(msg, color=color) if hasattr(bch, "bench_errors"): sep = os.linesep + " - " bch.fatal(sep.join(["Benchmarks errors:"] + bch.bench_errors))
def execute(self): self.init_dirs() self.cachedir = self.bldnode.make_node(Build.CACHE_DIR) self.cachedir.mkdir() path = os.path.join(self.bldnode.abspath(), WAF_CONFIG_LOG) self.logger = Logs.make_logger(path, 'cfg') app = getattr(Context.g_module, 'APPNAME', '') if app: ver = getattr(Context.g_module, 'VERSION', '') if ver: app = "%s (%s)" % (app, ver) now = time.ctime() pyver = sys.hexversion systype = sys.platform args = " ".join(sys.argv) wafver = Context.WAFVERSION abi = Context.ABI self.to_log(conf_template % vars()) self.msg('Setting top to', self.srcnode.abspath()) self.msg('Setting out to', self.bldnode.abspath()) if id(self.srcnode) == id(self.bldnode): Logs.warn('Setting top == out (remember to use "update_outputs")') elif id(self.path) != id(self.srcnode): if self.srcnode.is_child_of(self.path): Logs.warn( 'Are you certain that you do not want to set top="." ?') super(ConfigurationContext, self).execute() self.store() Context.top_dir = self.srcnode.abspath() Context.out_dir = self.bldnode.abspath() env = ConfigSet.ConfigSet() env['argv'] = sys.argv env['options'] = Options.options.__dict__ env.run_dir = Context.run_dir env.top_dir = Context.top_dir env.out_dir = Context.out_dir env['hash'] = self.hash env['files'] = self.files env['environ'] = dict(self.environ) if not self.env.NO_LOCK_IN_RUN and not getattr(Options.options, 'no_lock_in_run'): env.store(os.path.join(Context.run_dir, Options.lockfile)) if not self.env.NO_LOCK_IN_TOP and not getattr(Options.options, 'no_lock_in_top'): env.store(os.path.join(Context.top_dir, Options.lockfile)) if not self.env.NO_LOCK_IN_OUT and not getattr(Options.options, 'no_lock_in_out'): env.store(os.path.join(Context.out_dir, Options.lockfile))
def benchmarks_format_output (bch): from waflib import Logs logfile = os.path.join (bch.bldnode.abspath(), "benchmarks.log") bch.logger = Logs.make_logger (logfile, "benchmarks") def compute_score (data): S = 0.0 prev_elt = None for d in data: eps = d["eps"] time = d["time"] if not prev_elt is None: prev_eps, prev_time = prev_elt log10_eps = -math.log10(eps) prev_log10_eps = -math.log10(prev_eps) S += (log10_eps-prev_log10_eps)*(time+prev_time)/2 prev_elt = (eps, time) return S #if bch.options.BENCHS_CMP_TO: # cmpdata = parse_results_file (bch.options.BENCHS_CMP_TO) cmpdata = {} D = getattr (bch, 'bench_results', {}) for benchs_name, benchs_data_dict in sorted(D.items(), key = lambda x:x[0]): bch.msg ("===== %s =====" % benchs_name, "==========", color = "NORMAL") for f, data in sorted(benchs_data_dict.items(), key = lambda x:x[0]): bch.start_msg (f) n = len (data) S = compute_score (data) msg = "%d measure%s, Score = %g" % (n, "s" if n > 1 else "", S) color = "CYAN" cmpS, _ = cmpdata.get (f, (None, None)) if cmpS: percent = 100.*(S/cmpS-1.) msg += " (%0.2f%%)" % percent if percent <= 0: color = "GREEN" elif percent >= 2.5: color = "RED" else: color = "YELLOW" bch.end_msg (msg, color = color) if hasattr (bch, "bench_errors"): sep = os.linesep + " - " bch.fatal (sep.join (["Benchmarks errors:"] + bch.bench_errors))
def benchmarks_format_output (bch): # The logger is freed at the end of the benchmarks function but the tasks are # performed afterwards, so we recreate the logger. logfile = os.path.join (bch.bldnode.abspath(), "benchmarks_run.log") bch.logger = Logs.make_logger (logfile, "benchmarks_run") lst = sorted (getattr (bch, 'bench_results', []), key = lambda x:x[0]) for (f, ret, log) in lst: bch.start_msg (f.relpath ()) if ret == 0: bch.end_msg (log.relpath()) else: bch.end_msg ("Error", color = "RED") Logs.free_logger (bch.logger) bch.logger = None
def execute(self): self.init_dirs() self.cachedir=self.bldnode.make_node(Build.CACHE_DIR) self.cachedir.mkdir() path=os.path.join(self.bldnode.abspath(),WAF_CONFIG_LOG) self.logger=Logs.make_logger(path,'cfg') app=getattr(Context.g_module,'APPNAME','') if app: ver=getattr(Context.g_module,'VERSION','') if ver: app="%s (%s)"%(app,ver) now=time.ctime() pyver=sys.hexversion systype=sys.platform args=" ".join(sys.argv) wafver=Context.WAFVERSION abi=Context.ABI self.to_log(conf_template%vars()) self.msg('Setting top to',self.srcnode.abspath()) self.msg('Setting out to',self.bldnode.abspath()) if id(self.srcnode)==id(self.bldnode): Logs.warn('Setting top == out (remember to use "update_outputs")') elif id(self.path)!=id(self.srcnode): if self.srcnode.is_child_of(self.path): Logs.warn('Are you certain that you do not want to set top="." ?') super(ConfigurationContext,self).execute() self.store() Context.top_dir=self.srcnode.abspath() Context.out_dir=self.bldnode.abspath() env=ConfigSet.ConfigSet() env['argv']=sys.argv env['options']=Options.options.__dict__ env.run_dir=Context.run_dir env.top_dir=Context.top_dir env.out_dir=Context.out_dir env['hash']=self.hash env['files']=self.files env['environ']=dict(self.environ) if not self.env.NO_LOCK_IN_RUN: env.store(Context.run_dir+os.sep+Options.lockfile) if not self.env.NO_LOCK_IN_TOP: env.store(Context.top_dir+os.sep+Options.lockfile) if not self.env.NO_LOCK_IN_OUT: env.store(Context.out_dir+os.sep+Options.lockfile)
def execute(self): self.init_dirs() self.cachedir=self.bldnode.make_node(Build.CACHE_DIR) self.cachedir.mkdir() path=os.path.join(self.bldnode.abspath(),self.cmd+".log") self.logger=Logs.make_logger(path,'cfg') app=getattr(Context.g_module,'APPNAME','') if app: ver=getattr(Context.g_module,'VERSION','') if ver: app="%s (%s)"%(app,ver) if id(self.srcnode)==id(self.bldnode): Logs.warn('Setting top == out (remember to use "update_outputs")') elif id(self.path)!=id(self.srcnode): if self.srcnode.is_child_of(self.path): Logs.warn('Are you certain that you do not want to set top="." ?') Context.top_dir=self.srcnode.abspath() Context.out_dir=self.bldnode.abspath() self.work()
def prebuild(ctx): try: os.makedirs('build/waf') except OSError: pass ctx.logger = Logs.make_logger('build/waf/prebuild.log', 'prebuild') # Preconfiguration to decide target name out = 'build/waf/' preconfigureContext = PreconfigurationContext() preconfigureContext.out_dir = out preconfigureContext.options = ctx.options preconfigureContext.execute() # Real configuration out = 'build/waf/'+preconfigureContext.env.TARGETNAME configureContext = ConfigurationContext() configureContext.out_dir = out configureContext.init_dirs() configureContext.options = ctx.options configureContext.env = preconfigureContext.env configureContext.env.VARIANT = ctx.variant try: configureContext.execute() except Exception as e: ctx.start_msg("configuring toolchain ") ctx.end_msg("failed", color="RED") print e pass else: ctx.start_msg("configuring toolchain ") ctx.end_msg("ok", color="GREEN") # build buildContext = CustomBuildContext() buildContext.options = ctx.options buildContext.variant = ctx.variant buildContext.cmd = ctx.variant buildContext.execute()
def __init__(self, cmd_argv, options_context, pkg, run_node): super(ConfigureWafContext, self).__init__(cmd_argv, options_context, pkg, run_node) run_path = self.run_node.abspath() source_path = self.top_node.abspath() build_path = self.build_node.abspath() _init(run_path=run_path, source_path=source_path, build_path=build_path) opts = OptionsContext() opts.parse_args([]) opts.load("compiler_c") Options.options.check_c_compiler = "gcc" self.waf_options_context = opts waf_context = create_context("configure", run_dir=source_path) waf_context.options = Options.options waf_context.init_dirs() waf_context.cachedir = waf_context.bldnode.make_node(Build.CACHE_DIR) waf_context.cachedir.mkdir() path = os.path.join(waf_context.bldnode.abspath(), WAF_CONFIG_LOG) waf_context.logger = Logs.make_logger(path, 'cfg') self.waf_context = waf_context # FIXME: this is wrong (not taking into account sub packages) has_compiled_code = len(pkg.extensions) > 0 or len(pkg.compiled_libraries) > 0 if not has_compiled_code: if pkg.subpackages: for v in pkg.subpackages.values(): if len(v.extensions) > 0 or len(v.compiled_libraries) > 0: has_compiled_code = True break conf = self.waf_context if has_compiled_code: conf.load("compiler_c") conf.load("python") conf.check_python_version((2,4,2)) conf.check_python_headers() # HACK for mac os x if sys.platform == "darwin": conf.env["CC"] = ["/usr/bin/gcc-4.0"] self._old_path = None
def execute(self): self.init_dirs() self.cachedir = self.bldnode.make_node(Build.CACHE_DIR) self.cachedir.mkdir() path = os.path.join(self.bldnode.abspath(), self.cmd + ".log") self.logger = Logs.make_logger(path, 'cfg') app = getattr(Context.g_module, 'APPNAME', '') if app: ver = getattr(Context.g_module, 'VERSION', '') if ver: app = "%s (%s)" % (app, ver) if id(self.srcnode) == id(self.bldnode): Logs.warn('Setting top == out (remember to use "update_outputs")') elif id(self.path) != id(self.srcnode): if self.srcnode.is_child_of(self.path): Logs.warn( 'Are you certain that you do not want to set top="." ?') Context.top_dir = self.srcnode.abspath() Context.out_dir = self.bldnode.abspath() self.work()
def execute(self): self.init_dirs() self.cachedir = self.bldnode.make_node(Build.CACHE_DIR) self.cachedir.mkdir() path = os.path.join(self.bldnode.abspath(), WAF_CONFIG_LOG) self.logger = Logs.make_logger(path, 'cfg') app = getattr(Context.g_module, 'APPNAME', '') if app: ver = getattr(Context.g_module, 'VERSION', '') if ver: app = "%s (%s)" % (app, ver) now = time.ctime() pyver = sys.hexversion systype = sys.platform args = " ".join(sys.argv) wafver = Context.WAFVERSION abi = Context.ABI self.to_log(conf_template % vars()) self.msg('Setting top to', self.srcnode.abspath()) self.msg('Setting out to', self.bldnode.abspath()) if id(self.srcnode) == id(self.bldnode): Logs.warn('setting top == out') elif id(self.path) != id(self.srcnode): if self.srcnode.is_child_of(self.path): Logs.warn('Using an uncommon top directory') super(ConfigurationContext, self).execute() self.store() Context.top_dir = self.srcnode.abspath() Context.out_dir = self.bldnode.abspath() env = ConfigSet.ConfigSet() env['argv'] = sys.argv env['options'] = Options.options.__dict__ env.run_dir = Context.run_dir env.top_dir = Context.top_dir env.out_dir = Context.out_dir env['hash'] = self.hash env['files'] = self.files env['environ'] = dict(self.environ) env.store(Context.run_dir + os.sep + Options.lockfile) env.store(Context.top_dir + os.sep + Options.lockfile) env.store(Context.out_dir + os.sep + Options.lockfile)
def execute(self): self.init_dirs() self.cachedir=self.bldnode.make_node(Build.CACHE_DIR) self.cachedir.mkdir() path=os.path.join(self.bldnode.abspath(),WAF_CONFIG_LOG) self.logger=Logs.make_logger(path,'cfg') app=getattr(Context.g_module,'APPNAME','') if app: ver=getattr(Context.g_module,'VERSION','') if ver: app="%s (%s)"%(app,ver) params={'now':time.ctime(),'pyver':sys.hexversion,'systype':sys.platform,'args':" ".join(sys.argv),'wafver':Context.WAFVERSION,'abi':Context.ABI,'app':app} self.to_log(conf_template%params) self.msg('Setting top to',self.srcnode.abspath()) self.msg('Setting out to',self.bldnode.abspath()) if id(self.srcnode)==id(self.bldnode): Logs.warn('Setting top == out') elif id(self.path)!=id(self.srcnode): if self.srcnode.is_child_of(self.path): Logs.warn('Are you certain that you do not want to set top="." ?') super(ConfigurationContext,self).execute() self.store() Context.top_dir=self.srcnode.abspath() Context.out_dir=self.bldnode.abspath() env=ConfigSet.ConfigSet() env.argv=sys.argv env.options=Options.options.__dict__ env.config_cmd=self.cmd env.run_dir=Context.run_dir env.top_dir=Context.top_dir env.out_dir=Context.out_dir env.hash=self.hash env.files=self.files env.environ=dict(self.environ) if not self.env.NO_LOCK_IN_RUN and not getattr(Options.options,'no_lock_in_run'): env.store(os.path.join(Context.run_dir,Options.lockfile)) if not self.env.NO_LOCK_IN_TOP and not getattr(Options.options,'no_lock_in_top'): env.store(os.path.join(Context.top_dir,Options.lockfile)) if not self.env.NO_LOCK_IN_OUT and not getattr(Options.options,'no_lock_in_out'): env.store(os.path.join(Context.out_dir,Options.lockfile))
def build(bld): env = bld.env zpy = bld.zpy if not bld.logger: #...use default name until we actually need multiple builds _log_name = 'build' _log_file = '%s.log' % _log_name _log_path = pth.join(bld.bldnode.abspath(), '%s.log' % _log_name) bld.logger = Logs.make_logger(_log_path, _log_name) bld.o = bld.root.make_node(zpy.o) bld.py = bld.bldnode.find_node('python') dists = sorted(zpy.dist.keys()) bld.add_group() bld(features='zpy-update', target=dists) bld.add_group() bld(features='zpy-profile') bld.add_group() bld(features='zpy-extension', target='setuptools') bld.add_group() bld(features='zpy-extension', target=dists, excl=('python', 'setuptools', 'versiontools')) bld.add_group() bld(features='zpy-replay') bld.add_group() bld(features='zpy-final') #if bld.cmd.endswith(('install', 'build')): # bld.add_post_fun(test) if bld.cmd.endswith(('install'),) and zpy.ins: install(bld)
def execute(self): # copy-paste from the original method, but without the cache file creation self.init_dirs() path = os.path.join(self.bldnode.abspath(), 'config.log') self.logger = Logs.make_logger(path, 'cfg') app = getattr(Context.g_module, 'APPNAME', '') if app: ver = getattr(Context.g_module, 'VERSION', '') if ver: app = "%s (%s)" % (app, ver) now = time.ctime() pyver = sys.hexversion systype = sys.platform args = " ".join(sys.argv) wafver = Context.WAFVERSION abi = Context.ABI self.to_log(Configure.conf_template % vars()) super(Configure.ConfigurationContext, self).execute()
def execute(self): """ See :py:func:`waflib.Context.Context.execute` """ self.init_dirs() self.cachedir = self.bldnode.make_node(Build.CACHE_DIR) self.cachedir.mkdir() path = os.path.join(self.bldnode.abspath(), WAF_CONFIG_LOG) self.logger = Logs.make_logger(path, "cfg") app = getattr(Context.g_module, "APPNAME", "") if app: ver = getattr(Context.g_module, "VERSION", "") if ver: app = f"{app} ({ver})" params = { "now": time.ctime(), "pyver": sys.hexversion, "systype": sys.platform, "args": " ".join(sys.argv), "wafver": Context.WAFVERSION, "abi": Context.ABI, "app": app, } self.to_log(conf_template % params) self.msg("Setting top to", self.srcnode.abspath()) self.msg("Setting out to", self.bldnode.abspath()) if id(self.srcnode) == id(self.bldnode): Logs.warn("Setting top == out") elif id(self.path) != id(self.srcnode): if self.srcnode.is_child_of(self.path): Logs.warn('Are you certain that you do not want to set top="." ?') super().execute() self.store() Context.top_dir = self.srcnode.abspath() Context.out_dir = self.bldnode.abspath() # this will write a configure lock so that subsequent builds will # consider the current path as the root directory (see prepare_impl). # to remove: use 'waf distclean' env = ConfigSet.ConfigSet() env.argv = sys.argv env.options = Options.options.__dict__ env.config_cmd = self.cmd env.run_dir = Context.run_dir env.top_dir = Context.top_dir env.out_dir = Context.out_dir # conf.hash & conf.files hold wscript files paths and hash # (used only by Configure.autoconfig) env.hash = self.hash env.files = self.files env.environ = dict(self.environ) if not ( self.env.NO_LOCK_IN_RUN or env.environ.get("NO_LOCK_IN_RUN") or getattr(Options.options, "no_lock_in_run") ): env.store(os.path.join(Context.run_dir, Options.lockfile)) if not ( self.env.NO_LOCK_IN_TOP or env.environ.get("NO_LOCK_IN_TOP") or getattr(Options.options, "no_lock_in_top") ): env.store(os.path.join(Context.top_dir, Options.lockfile)) if not ( self.env.NO_LOCK_IN_OUT or env.environ.get("NO_LOCK_IN_OUT") or getattr(Options.options, "no_lock_in_out") ): env.store(os.path.join(Context.out_dir, Options.lockfile))
def execute(self): # Check whether the main wscript has a resolve function defined, # if not we create one. This is also done for other functions such # as options by waf itself. See: # https://github.com/waf-project/waf/blob/master/waflib/Scripting.py#L201-L207 # if 'resolve' not in Context.g_module.__dict__: Context.g_module.resolve = Utils.nada # Create the nodes that will be used during the resolve step. The build # directory is also used by the waf BuildContext self.srcnode = self.path self.bldnode = self.path.make_node('build') self.bldnode.mkdir() default_resolve_path = os.path.join( self.path.abspath(), 'resolved_dependencies') default_symlinks_path = os.path.join( self.path.abspath(), 'resolve_symlinks') self.registry = registry.build_registry( ctx=self, git_binary='git', semver=semver, archive_extractor=archive.extract, default_resolve_path=default_resolve_path, resolve_config_path=self.resolve_config_path(), default_symlinks_path=default_symlinks_path, waf_utils=Utils, args=sys.argv[1:], project_path=self.path.abspath(), waf_lock_file=Options.lockfile) # Enable/disable colors based on the currently used terminal. # Note: this prevents jumbled output if waf is invoked from an IDE # that does not render colors in its output window Logs.enable_colors(1) # Lets make a different log file for the different resolver chains configuration = self.registry.require('configuration') path = os.path.join(self.bldnode.abspath(), configuration.resolver_chain() + '.resolve.log') self.logger = Logs.make_logger(path, 'cfg') self.logger.debug('wurf: Resolve execute {}'.format( configuration.resolver_chain())) self.dependency_manager = self.registry.require('dependency_manager') try: # Calling the context execute will call the resolve(...) functions # in the wscripts. These will in turn call add_dependency(...) # which will trigger loading the dependency. super(WafResolveContext, self).execute() except Error as e: self.logger.debug("Error in resolve:\n", exc_info=True) self.fatal(str(e)) except Exception: raise # Get the cache with the resolved dependencies global dependency_cache dependency_cache = self.registry.require('dependency_cache') self.logger.debug('wurf: dependency_cache {}'.format(dependency_cache)) # If needed execute any actions which cannot run until after the # dependency resolution has completed post_resolver_actions = self.registry.require('post_resolver_actions') for action in post_resolver_actions: action()
def run(self): """ Execute the test. This can fail. """ testname = str(self.inputs[0]) filename = self.inputs[0].abspath() bld = self.generator.bld if not bld.logger: bld.logger = Logs.make_logger( os.path.join(bld.out_dir, "test.log"), 'unites_logger') self.unites_exec = getattr(self.generator, 'unites_exec', [filename]) if getattr(self.generator, 'unites_fun', None): # FIXME waf 1.8 - add a return statement here? self.generator.unites_fun(self) try: shenv = getattr(self.generator.bld, 'all_test_paths') except AttributeError: # this operation may be performed by at most #maxjobs shenv = os.environ.copy() lst = [] for g in self.generator.bld.groups: for tg in g: if getattr(tg, 'link_task', None): s = tg.link_task.outputs[0].parent.abspath() if s not in lst: lst.append(s) def add_path(dct, path, var): dct[var] = os.pathsep.join( Utils.to_list(path) + [os.environ.get(var, '')]) if Utils.is_win32: add_path(shenv, lst, 'PATH') elif Utils.unversioned_sys_platform() == 'darwin': add_path(shenv, lst, 'DYLD_LIBRARY_PATH') add_path(shenv, lst, 'LD_LIBRARY_PATH') else: add_path(shenv, lst, 'LD_LIBRARY_PATH') bld.all_test_paths = shenv cwd = getattr(self.generator, 'unites_cwd', '') or self.inputs[0].parent.abspath() testcmd = getattr(Options.options, 'testcmd', False) if testcmd: self.unites_exec = (testcmd % self.unites_exec[0]).split(' ') bld.start_msg("Running test \'%s\'" % (testname)) proc = Utils.subprocess.Popen(self.unites_exec,\ cwd=cwd,\ env=shenv,\ stderr=Utils.subprocess.PIPE,\ stdout=Utils.subprocess.PIPE) (out, err) = proc.communicate() if proc.returncode == 0: bld.end_msg("passed", 'GREEN') else: msg = [] if out: msg.append('stdout:%s%s' % (os.linesep, out.decode('utf-8'))) if err: msg.append('stderr:%s%s' % (os.linesep, err.decode('utf-8'))) msg = os.linesep.join(msg) bld.end_msg("FAIL", 'RED') bld.to_log(msg) if not getattr(Options.options, 'permissive_tests', False): raise Errors.WafError('Test \'%s\' failed' % (testname)) if not getattr(bld, 'unites_summary', None): bld.unites_summary = {} bld.unites_summary[testname] = (proc.returncode != 0)
def benchmarks_format_output(bch): from waflib import Logs logfile = os.path.join(bch.bldnode.abspath(), "benchmarks.log") bch.logger = Logs.make_logger(logfile, "benchmarks") if not bch.cmp_only: bch.msg("", "", color="NORMAL") bch.msg("##### %s #####" % BenchCurrentRef(), "##########", color="NORMAL") fmt = "{:^9{fmt}} {:^9{fmt}} {:^9{fmt}} {:^9{fmt}}" D = bch.bench_results[BenchCurrentRef()] for groupname, groupdict in sorted(D.items(), key=lambda x: x[0]): bch.msg("===== %s =====" % groupname, "==========", color="NORMAL") for k, v in groupdict["args"].items(): bch.msg("args: %s" % k, v, color="NORMAL") for f, data in sorted(groupdict["data"].items(), key=lambda x: x[0]): head = fmt.format("min", "av", "max", "std", fmt="s") bch.msg(f, head, color="CYAN") for eps in reversed(sorted(set(d["eps"] for d in data))): eps_time = set(d["time"] for d in data if d["eps"] == eps) m, M, av, std = set_stats(eps_time) c = "YELLOW" if M / m > 2 else "NORMAL" row = fmt.format(m, av, M, std, fmt=".2e") bch.msg(" eps = %r" % eps, row, color=c) for k, D in bch.bench_cmp.items(): bch.msg(" ", " ", color="NORMAL") bch.msg("##### Comparison #####", "##########", color="NORMAL") bch.msg("reference", str(k[0]), color="NORMAL") bch.msg("compare with", str(k[1]), color="NORMAL") for groupname, groupdict in sorted(D.items(), key=lambda x: x[0]): bch.msg("===== %s =====" % groupname, "==========", color="NORMAL") for f, data in sorted(groupdict.items(), key=lambda x: x[0]): bch.msg(f, "std1/std0 (av1-av0)/std0 #cells1/#cells0", color="CYAN") for eps_data in data: msg_s = " eps = %r" % eps_data["eps"] rstd = eps_data["std1/std0"] r = eps_data["(av1-av0)/std0"] rc = eps_data["#cells1/#cells0"] fmt = " %s%.2f%s %s%.2f%s %.2f" if rstd >= BENCHS_INSTABLE_FACTOR: c1 = Logs.colors.RED elif rstd <= 1. / BENCHS_INSTABLE_FACTOR: c1 = Logs.colors.GREEN else: c1 = Logs.colors.NORMAL args = [c1, rstd, Logs.colors.NORMAL] if r >= BENCHS_CMP_REGRESSION_FACTOR: c2 = Logs.colors.RED elif -r >= BENCHS_CMP_IMPROVMENT_FACTOR: c2 = Logs.colors.GREEN else: c2 = Logs.colors.NORMAL args += [c2, r, Logs.colors.NORMAL, rc] bch.msg(msg_s, fmt % tuple(args)) if bch.bench_errors: sep = os.linesep + " - " bch.fatal(sep.join(["Benchmarks errors:"] + bch.bench_errors))
def run(self): """ Execute the test. This can fail. """ testname = str(self.inputs[0]) filename = self.inputs[0].abspath() bld = self.generator.bld if not bld.logger: bld.logger = Logs.make_logger(os.path.join(bld.out_dir, "test.log"), "unites_logger") self.unites_exec = getattr(self.generator, "unites_exec", [filename]) if getattr(self.generator, "unites_fun", None): # FIXME waf 1.8 - add a return statement here? self.generator.unites_fun(self) try: shenv = getattr(self.generator.bld, "all_test_paths") except AttributeError: # this operation may be performed by at most #maxjobs shenv = os.environ.copy() lst = [] for g in self.generator.bld.groups: for tg in g: if getattr(tg, "link_task", None): s = tg.link_task.outputs[0].parent.abspath() if s not in lst: lst.append(s) def add_path(dct, path, var): dct[var] = os.pathsep.join(Utils.to_list(path) + [os.environ.get(var, "")]) if Utils.is_win32: add_path(shenv, lst, "PATH") elif Utils.unversioned_sys_platform() == "darwin": add_path(shenv, lst, "DYLD_LIBRARY_PATH") add_path(shenv, lst, "LD_LIBRARY_PATH") else: add_path(shenv, lst, "LD_LIBRARY_PATH") bld.all_test_paths = shenv cwd = getattr(self.generator, "unites_cwd", "") or self.inputs[0].parent.abspath() testcmd = getattr(Options.options, "testcmd", False) if testcmd: self.unites_exec = (testcmd % self.unites_exec[0]).split(" ") bld.start_msg("Running test '%s'" % (testname)) proc = Utils.subprocess.Popen( self.unites_exec, cwd=cwd, env=shenv, stderr=Utils.subprocess.PIPE, stdout=Utils.subprocess.PIPE ) (out, err) = proc.communicate() if proc.returncode == 0: bld.end_msg("passed", "GREEN") else: msg = [] if out: msg.append("stdout:%s%s" % (os.linesep, out.decode("utf-8"))) if err: msg.append("stderr:%s%s" % (os.linesep, err.decode("utf-8"))) msg = os.linesep.join(msg) bld.end_msg("FAIL", "RED") bld.to_log(msg) if not getattr(Options.options, "permissive_tests", False): raise Errors.WafError("Test '%s' failed" % (testname)) if not getattr(bld, "unites_summary", None): bld.unites_summary = {} bld.unites_summary[testname] = proc.returncode != 0
def run(self): """ Execute the test. This can fail. """ testname = str(self.inputs[0]) filename = self.inputs[0].abspath() bld = self.generator.bld if not bld.logger: bld.logger = Logs.make_logger(os.path.join(bld.out_dir, "test.log"), 'unites_logger') self.unites_exec = getattr(self.generator, 'unites_exec', [filename]) if getattr(self.generator, 'unites_fun', None): # FIXME waf 1.8 - add a return statement here? self.generator.unites_fun(self) try: shenv = getattr(self.generator.bld, 'all_test_paths') except AttributeError: # this operation may be performed by at most #maxjobs shenv = os.environ.copy() lst = [] for g in self.generator.bld.groups: for tg in g: if getattr(tg, 'link_task', None): s = tg.link_task.outputs[0].parent.abspath() if s not in lst: lst.append(s) def add_path(dct, path, var): dct[var] = os.pathsep.join(Utils.to_list(path) + [os.environ.get(var, '')]) if Utils.is_win32: add_path(shenv, lst, 'PATH') elif Utils.unversioned_sys_platform() == 'darwin': add_path(shenv, lst, 'DYLD_LIBRARY_PATH') add_path(shenv, lst, 'LD_LIBRARY_PATH') else: add_path(shenv, lst, 'LD_LIBRARY_PATH') bld.all_test_paths = shenv cwd = getattr(self.generator, 'unites_cwd', '') or self.inputs[0].parent.abspath() testcmd = getattr(Options.options, 'testcmd', False) if testcmd: self.unites_exec = (testcmd % self.unites_exec[0]).split(' ') bld.start_msg("Running test \'%s\'" % (testname)) proc = Utils.subprocess.Popen(self.unites_exec,\ cwd=cwd,\ env=shenv,\ stderr=Utils.subprocess.PIPE,\ stdout=Utils.subprocess.PIPE) (out, err) = proc.communicate() if proc.returncode==0: bld.end_msg ("passed", 'GREEN'); else: msg = [] if out: msg.append('stdout:%s%s' % (os.linesep, out.decode('utf-8'))) if err: msg.append('stderr:%s%s' % (os.linesep, err.decode('utf-8'))) msg = os.linesep.join(msg) bld.end_msg ("FAIL", 'RED'); bld.to_log(msg) if not getattr(Options.options, 'permissive_tests', False): raise Errors.WafError('Test \'%s\' failed' % (testname))
def benchmarks_format_output (bch): from waflib import Logs logfile = os.path.join (bch.bldnode.abspath(), "benchmarks.log") bch.logger = Logs.make_logger (logfile, "benchmarks") if not bch.cmp_only: bch.msg ("", "", color="NORMAL") bch.msg ("##### %s #####" % BenchCurrentRef(), "##########", color="NORMAL") fmt = "{:^9{fmt}} {:^9{fmt}} {:^9{fmt}} {:^9{fmt}}" D = bch.bench_results[BenchCurrentRef()] for groupname, groupdict in sorted(D.items(), key = lambda x:x[0]): bch.msg ("===== %s =====" % groupname, "==========", color = "NORMAL") for k,v in groupdict["args"].items(): bch.msg ("args: %s" % k, v, color = "NORMAL") for f, data in sorted(groupdict["data"].items(), key = lambda x:x[0]): head = fmt.format ("min", "av", "max", "std", fmt="s") bch.msg (f, head, color = "CYAN") for eps in reversed(sorted(set(d["eps"] for d in data))): eps_time = set (d["time"] for d in data if d["eps"] == eps) m, M, av, std = set_stats (eps_time) c = "YELLOW" if M/m > 2 else "NORMAL" row = fmt.format (m, av, M, std, fmt=".2e") bch.msg (" eps = %r" % eps, row, color=c) for k, D in bch.bench_cmp.items(): bch.msg (" ", " ", color="NORMAL") bch.msg ("##### Comparison #####", "##########", color = "NORMAL") bch.msg ("reference", str(k[0]), color = "NORMAL") bch.msg ("compare with", str(k[1]), color = "NORMAL") for groupname, groupdict in sorted(D.items(), key = lambda x:x[0]): bch.msg ("===== %s =====" % groupname, "==========", color = "NORMAL") for f, data in sorted(groupdict.items(), key = lambda x:x[0]): bch.msg (f, "std1/std0 (av1-av0)/std0 #cells1/#cells0", color = "CYAN") for eps_data in data: msg_s = " eps = %r" % eps_data["eps"] rstd = eps_data["std1/std0"] r = eps_data["(av1-av0)/std0"] rc = eps_data["#cells1/#cells0"] fmt = " %s%.2f%s %s%.2f%s %.2f" if rstd >= BENCHS_INSTABLE_FACTOR: c1 = Logs.colors.RED elif rstd <= 1./BENCHS_INSTABLE_FACTOR: c1 = Logs.colors.GREEN else: c1 = Logs.colors.NORMAL args = [ c1, rstd, Logs.colors.NORMAL ] if r >= BENCHS_CMP_REGRESSION_FACTOR: c2 = Logs.colors.RED elif -r >= BENCHS_CMP_IMPROVMENT_FACTOR: c2 = Logs.colors.GREEN else: c2 = Logs.colors.NORMAL args += [ c2, r, Logs.colors.NORMAL, rc ] bch.msg (msg_s, fmt % tuple(args)) if bch.bench_errors: sep = os.linesep + " - " bch.fatal (sep.join (["Benchmarks errors:"] + bch.bench_errors))
def execute(self): """ See :py:func:`waflib.Context.Context.execute` """ self.init_dirs() Logs.info("[WAF] Executing 'configure'") self.cachedir = self.bldnode.make_node(Build.CACHE_DIR) self.cachedir.mkdir() path = os.path.join(self.bldnode.abspath(), WAF_CONFIG_LOG) self.logger = Logs.make_logger(path, "cfg") app = getattr(Context.g_module, "APPNAME", "") if app: ver = getattr(Context.g_module, "VERSION", "") if ver: app = "%s (%s)" % (app, ver) now = time.ctime() pyver = sys.hexversion systype = sys.platform args = " ".join(sys.argv) wafver = Context.WAFVERSION abi = Context.ABI self.to_log(conf_template % vars()) if id(self.srcnode) == id(self.bldnode): Logs.warn('Setting top == out (remember to use "update_outputs")') elif id(self.path) != id(self.srcnode): if self.srcnode.is_child_of(self.path): Logs.warn('Are you certain that you do not want to set top="." ?') super(ConfigurationContext, self).execute() self.store() Context.top_dir = self.srcnode.abspath() Context.out_dir = self.bldnode.abspath() # import waf branch spec branch_spec_globals = Context.load_branch_spec(Context.top_dir) Context.lock_dir = Context.run_dir + os.sep + branch_spec_globals["BINTEMP_FOLDER"] # this will write a configure lock so that subsequent builds will # consider the current path as the root directory (see prepare_impl). # to remove: use 'waf distclean' env = ConfigSet.ConfigSet() env["argv"] = sys.argv env["options"] = Options.options.__dict__ env.run_dir = Context.run_dir env.top_dir = Context.top_dir env.out_dir = Context.out_dir env.lock_dir = Context.lock_dir # Add cry_waf.exe for dependency tracking cry_waf_exe_node = self.path.make_node("cry_waf.exe") self.hash = hash((self.hash, cry_waf_exe_node.read("rb"))) self.files.append(os.path.normpath(cry_waf_exe_node.abspath())) # conf.hash & conf.files hold wscript files paths and hash # (used only by Configure.autoconfig) env["hash"] = self.hash env["files"] = self.files env["environ"] = dict(self.environ) env.store(Context.lock_dir + os.sep + Options.lockfile)
def execute(self): """ See :py:func:`waflib.Context.Context.execute` """ self.init_dirs() Logs.info("[WAF] Executing 'configure'") self.cachedir = self.bldnode.make_node(Build.CACHE_DIR) self.cachedir.mkdir() path = os.path.join(self.bldnode.abspath(), WAF_CONFIG_LOG) self.logger = Logs.make_logger(path, 'cfg') app = getattr(Context.g_module, 'APPNAME', '') if app: ver = getattr(Context.g_module, 'VERSION', '') if ver: app = "%s (%s)" % (app, ver) now = time.ctime() pyver = sys.hexversion systype = sys.platform args = " ".join(sys.argv) wafver = Context.WAFVERSION abi = Context.ABI self.to_log(conf_template % vars()) if id(self.srcnode) == id(self.bldnode): Logs.warn('Setting top == out (remember to use "update_outputs")') elif id(self.path) != id(self.srcnode): if self.srcnode.is_child_of(self.path): Logs.warn( 'Are you certain that you do not want to set top="." ?') super(ConfigurationContext, self).execute() self.store() Context.top_dir = self.srcnode.abspath() Context.out_dir = self.bldnode.abspath() # import waf branch spec branch_spec_globals = Context.load_branch_spec(Context.top_dir) Context.lock_dir = Context.run_dir + os.sep + branch_spec_globals[ 'BINTEMP_FOLDER'] # this will write a configure lock so that subsequent builds will # consider the current path as the root directory (see prepare_impl). # to remove: use 'waf distclean' env = ConfigSet.ConfigSet() env['argv'] = sys.argv env['options'] = Options.options.__dict__ env.run_dir = Context.run_dir env.top_dir = Context.top_dir env.out_dir = Context.out_dir env.lock_dir = Context.lock_dir # Add lmbr_waf.bat or lmbr_waf for dependency tracking ############################################################################### waf_command = os.path.basename(sys.executable) if waf_command.lower() == 'python' or waf_command.lower( ) == 'python.exe': waf_executable = self.engine_node.make_node( './Tools/build/waf-1.7.13/lmbr_waf') else: waf_executable = self.path.make_node(waf_command) self.hash = hash((self.hash, waf_executable.read('rb'))) self.files.append(os.path.normpath(waf_executable.abspath())) # conf.hash & conf.files hold wscript files paths and hash # (used only by Configure.autoconfig) env['hash'] = self.hash env['files'] = self.files env['environ'] = dict(self.environ) env.store(Context.lock_dir + os.sep + Options.lockfile)
def execute(self): """ See :py:func:`waflib.Context.Context.execute` """ self.init_dirs() self.cachedir = self.bldnode.make_node(Build.CACHE_DIR) self.cachedir.mkdir() path = os.path.join(self.bldnode.abspath(), WAF_CONFIG_LOG) self.logger = Logs.make_logger(path, 'cfg') app = getattr(Context.g_module, 'APPNAME', '') if app: ver = getattr(Context.g_module, 'VERSION', '') if ver: app = "%s (%s)" % (app, ver) now = time.ctime() pyver = sys.hexversion systype = sys.platform args = " ".join(sys.argv) wafver = Context.WAFVERSION abi = Context.ABI self.to_log(conf_template % vars()) self.msg('Setting top to', self.srcnode.abspath()) self.msg('Setting out to', self.bldnode.abspath()) if id(self.srcnode) == id(self.bldnode): Logs.warn('Setting top == out (remember to use "update_outputs")') elif id(self.path) != id(self.srcnode): if self.srcnode.is_child_of(self.path): Logs.warn( 'Are you certain that you do not want to set top="." ?') super(ConfigurationContext, self).execute() self.store() Context.top_dir = self.srcnode.abspath() Context.out_dir = self.bldnode.abspath() # this will write a configure lock so that subsequent builds will # consider the current path as the root directory (see prepare_impl). # to remove: use 'waf distclean' env = ConfigSet.ConfigSet() env['argv'] = sys.argv env['options'] = Options.options.__dict__ env.run_dir = Context.run_dir env.top_dir = Context.top_dir env.out_dir = Context.out_dir # conf.hash & conf.files hold wscript files paths and hash # (used only by Configure.autoconfig) env['hash'] = self.hash env['files'] = self.files env['environ'] = dict(self.environ) if not self.env.NO_LOCK_IN_RUN: env.store(Context.run_dir + os.sep + Options.lockfile) if not self.env.NO_LOCK_IN_TOP: env.store(Context.top_dir + os.sep + Options.lockfile) if not self.env.NO_LOCK_IN_OUT: env.store(Context.out_dir + os.sep + Options.lockfile)
def execute(self): """ See :py:func:`waflib.Context.Context.execute` """ self.init_dirs() self.cachedir = self.bldnode.make_node(Build.CACHE_DIR) self.cachedir.mkdir() path = os.path.join(self.bldnode.abspath(), WAF_CONFIG_LOG) self.logger = Logs.make_logger(path, "cfg") app = getattr(Context.g_module, "APPNAME", "") if app: ver = getattr(Context.g_module, "VERSION", "") if ver: app = "%s (%s)" % (app, ver) now = time.ctime() pyver = sys.hexversion systype = sys.platform args = " ".join(sys.argv) wafver = Context.WAFVERSION abi = Context.ABI self.to_log(conf_template % vars()) self.msg("Setting top to", self.srcnode.abspath()) self.msg("Setting out to", self.bldnode.abspath()) if id(self.srcnode) == id(self.bldnode): Logs.warn('Setting top == out (remember to use "update_outputs")') elif id(self.path) != id(self.srcnode): if self.srcnode.is_child_of(self.path): Logs.warn('Are you certain that you do not want to set top="." ?') super(ConfigurationContext, self).execute() self.store() Context.top_dir = self.srcnode.abspath() Context.out_dir = self.bldnode.abspath() # this will write a configure lock so that subsequent builds will # consider the current path as the root directory (see prepare_impl). # to remove: use 'waf distclean' env = ConfigSet.ConfigSet() env["argv"] = sys.argv env["options"] = Options.options.__dict__ env.run_dir = Context.run_dir env.top_dir = Context.top_dir env.out_dir = Context.out_dir # conf.hash & conf.files hold wscript files paths and hash # (used only by Configure.autoconfig) env["hash"] = self.hash env["files"] = self.files env["environ"] = dict(self.environ) if not self.env.NO_LOCK_IN_RUN and not getattr(Options.options, "no_lock_in_run"): env.store(os.path.join(Context.run_dir, Options.lockfile)) if not self.env.NO_LOCK_IN_TOP and not getattr(Options.options, "no_lock_in_top"): env.store(os.path.join(Context.top_dir, Options.lockfile)) if not self.env.NO_LOCK_IN_OUT and not getattr(Options.options, "no_lock_in_out"): env.store(os.path.join(Context.out_dir, Options.lockfile))