def run_waf(self, args=None): start = os.getcwd() old_argv = sys.argv old_stderr = sys.stderr mystderr = StringIO.StringIO() try: os.chdir(self.basedir) cwd = os.getcwd() sys.stderr = mystderr import Scripting import Utils import Constants Utils.get_term_cols = lambda: 80 wafdir = os.environ['WAFDIR'] tools = os.path.join(wafdir, 'Tools') sys.argv = ['', 'configure', 'build', '-v'] if args: sys.argv += args sys.path = [wafdir, tools] + sys.path Scripting.prepare(tools, cwd, Constants.WAFVERSION, wafdir) except SystemExit: raise WafTestException(mystderr.getvalue()) finally: os.chdir(start) sys.argv = old_argv sys.stderr = old_stderr
def reconfigure(ctx): '''rerun configure if necessary''' import Configure, samba_wildcard, Scripting if not os.path.exists(".lock-wscript"): raise Utils.WafError('configure has not been run') bld = samba_wildcard.fake_build_environment() Configure.autoconfig = True Scripting.check_configured(bld)
def daemon(ctx): """waf command: rebuild as soon as something changes""" bld = None while True: try: bld = Utils.g_module.build_context() Scripting.build(bld) except Build.BuildError, e: Logs.warn(e) except KeyboardInterrupt: Utils.pprint('RED', 'interrupted') break
def fake_build_environment(info=True, flush=False): """create all the tasks for the project, but do not run the build return the build context in use""" bld = getattr(Utils.g_module, 'build_context', Utils.Context)() bld = Scripting.check_configured(bld) Options.commands['install'] = False Options.commands['uninstall'] = False Options.is_install = False bld.is_install = 0 # False try: proj = Environment.Environment(Options.lockfile) except IOError: raise Utils.WafError( "Project not configured (run 'waf configure' first)") bld.load_dirs(proj[SRCDIR], proj[BLDDIR]) bld.load_envs() if info: Logs.info("Waf: Entering directory `%s'" % bld.bldnode.abspath()) bld.add_subdirs([os.path.split(Utils.g_module.root_path)[0]]) bld.pre_build() if flush: bld.flush() return bld
def fake_build_environment(info=True, flush=False): """create all the tasks for the project, but do not run the build return the build context in use""" bld = getattr(Utils.g_module, 'build_context', Utils.Context)() bld = Scripting.check_configured(bld) Options.commands['install'] = False Options.commands['uninstall'] = False Options.is_install = False bld.is_install = 0 # False try: proj = Environment.Environment(Options.lockfile) except IOError: raise Utils.WafError("Project not configured (run 'waf configure' first)") bld.load_dirs(proj[SRCDIR], proj[BLDDIR]) bld.load_envs() if info: Logs.info("Waf: Entering directory `%s'" % bld.bldnode.abspath()) bld.add_subdirs([os.path.split(Utils.g_module.root_path)[0]]) bld.pre_build() if flush: bld.flush() return bld
def __init__(self): self.API = API.Base self.ScriptManager = Scripting.Hooks( API=self.API) #Put things in here to be API in scripts
def add_subdirs(self, dirs): for dir in Utils.to_list(dirs): if dir: Scripting.add_subdir(dir, self)