예제 #1
0
파일: driver.py 프로젝트: brettviren/worch
def main():
    wafdir = assure_unpack()
    wafver = wafdir2wafver(wafdir)

    sys.path.insert(0, os.path.realpath(wafdir))
    from waflib import Scripting
    Scripting.waf_entry_point(cwd, wafver, wafdir)
예제 #2
0
def reconfigure(ctx):
    '''rerun configure if necessary'''
    if not os.path.exists(os.environ.get('WAFLOCK', '.lock-wscript')):
        raise Errors.WafError('configure has not been run')
    import samba_wildcard
    bld = samba_wildcard.fake_build_environment()
    Configure.autoconfig = True
    Scripting.check_configured(bld)
    def new_execute_build(self):
        """
		Invoke clangdb command before build
		"""
        if self.cmd.startswith('build'):
            Scripting.run_command('clangdb')

        old_execute_build(self)
예제 #4
0
	def new_execute_build(self):
		"""
		Invoke clangdb command before build
		"""
		if type(self) == Build.BuildContext:
			Scripting.run_command('clangdb')

		old_execute_build(self)
    def run(self, perf_run, available_params, configurations):
        test_build_path = self.path.make_node(self.bldnode.name + '_tests')
       
        Options.lockfile = Options.lockfile + '_tests'
        Options.options.out = test_build_path.abspath()
        Options.options.profiling = self.env.profiling
        Options.options.input_file = os.path.relpath(self.env.INPUT_FILE, self.path.abspath())
        Options.options.reference_file = os.path.relpath(self.env.REFERENCE_FILE, self.path.abspath())

        for configuration in configurations:
            for configuration_param in available_params:
                setattr(Options.options, configuration_param, configuration_param in configuration['modules'])

            Logs.pprint('PINK', 'Testing %s build...' % configuration['id'])
      
            Scripting.run_command('configure')
            Scripting.run_command('build')
            Scripting.run_command('perf' if perf_run else 'debug')

            self.exec_command('cp %s %s' % (
                test_build_path.find_node('current_profile.txt').abspath(),
                self.bldnode.make_node('%s_profile.txt' % configuration['id']).abspath()))

            if perf_run:
                self.exec_command('cp %s %s' % (
                    test_build_path.find_node('current_profile_detailed.json').abspath(),
                    self.bldnode.make_node('%s_profile_detailed.json' % configuration['id']).abspath()))
         

        Scripting.run_command('distclean')
예제 #6
0
def build(bld, trees=[]):
	if bld.variant:
		libs = bld.env.CCROSS[bld.variant]['shlib']
		for lib in libs:
			bld.read_shlib(lib, paths=bld.env.LIBPATH)

	if bld.options.all and not bld.variant:
		if bld.cmd in ('build', 'clean', 'install', 'uninstall', 'codeblocks', 'makefile', 'eclipse'):
			for variant in bld.env.CCROSS.keys():
				Scripting.run_command('%s_%s' % (bld.cmd, variant))

	for tree in trees:
		for script in waftools.get_scripts(tree, 'wscript'):
			bld.recurse(script)
예제 #7
0
	def bdist_tar_bz2(self, appname, variant, version):
		'''Creates a tar.gz archive.

		:param appname: Functional application and bdist name
		:type appname: str
		:param variant: Name of the build variant (if any)
		:type variant: str or None
		:param version: Current version of the application being packaged
		:type version: str
		'''	
	
		name = '%s%s-%s' % (appname, variant, version)
		p = Logs.info
		p('')
		p('=======================')
		p('BDIST (tar.bz2)')
		p('=======================')
		p('PREFIX=%s' % self.env.PREFIX)	
		ctx = Scripting.Dist()
		ctx.arch_name = '%s.tar.bz2' % (name)
		ctx.files = self._bdist.ant_glob('**')
		ctx.tar_prefix = ''
		ctx.base_path = self._pkgroot
		ctx.archive()
		p('-----------------------')
예제 #8
0
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(Context.g_module, 'build_context', Utils.Context)()
    bld = Scripting.check_configured(bld)

    Options.commands['install'] = False
    Options.commands['uninstall'] = False

    bld.is_install = 0  # False

    try:
        proj = ConfigSet.ConfigSet(Options.lockfile)
    except IOError:
        raise Errors.WafError(
            "Project not configured (run 'waf configure' first)")

    bld.load_envs()

    if info:
        Logs.info("Waf: Entering directory `%s'" % bld.bldnode.abspath())
    bld.add_subdirs([os.path.split(Context.g_module.root_path)[0]])

    bld.pre_build()
    if flush:
        bld.flush()
    return bld
예제 #9
0
파일: orchlib.py 프로젝트: brettviren/worch
def start(cwd, version, wafdir):
    print ("cwd: %s" % cwd)
    print ("version: %s" % version)
    print ("wafdir: %s" % wafdir)
    Logs.init_log()
    Context.waf_dir = wafdir
    Context.launch_dir = Context.out_dir = Context.top_dir = Context.run_dir = cwd
    Context.g_module = imp.new_module('wscript')
    Context.g_module.root_path = cwd
    Context.Context.recurse = recurse_rep

    Context.g_module.configure = configure
    Context.g_module.build = build
    Context.g_module.options = options
    Context.g_module.top = Context.g_module.out = '.'

    Options.OptionsContext().execute()

    do_config = 'configure' in sys.argv
    try:
        os.stat(cwd + os.sep + 'c4che')
    except:
        do_config = True
    if do_config:
        Scripting.run_command('configure')

    if 'clean' in sys.argv:
        Scripting.run_command('clean')

    if 'build' in sys.argv:
        Scripting.run_command('build')
예제 #10
0
파일: makefile.py 프로젝트: michelm/beehive
	def execute(self, *k, **kw):
		self.failure = None
		self.commands = []
		self.targets = []

		old_exec = Task.TaskBase.exec_command
		def exec_command(self, *k, **kw):
			ret = old_exec(self, *k, **kw)
			try:
				cmd = k[0]
			except IndexError:
				cmd = ''
			finally:
				self.command_executed = cmd
			try:
				cwd = kw['cwd']
			except KeyError:
				cwd = self.generator.bld.cwd
			finally:
				self.path = cwd
			return ret
		Task.TaskBase.exec_command = exec_command

		old_process = Task.TaskBase.process
		def process(self):
			old_process(self)
			task_process(self)
		Task.TaskBase.process = process

		def postfun(self):
			if self.failure:
				build_show_failure(self)
			elif not len(self.targets):
				Logs.warn('makefile export failed: no C/C++ targets found')
			else:
				build_postfun(self)
		super(MakefileContext, self).add_post_fun(postfun)

		Scripting.run_command('clean')
		super(MakefileContext, self).execute(*k, **kw)
예제 #11
0
파일: ccenv.py 프로젝트: jameslin2014/xskit
def build(bld, trees=[]):
	'''Performs build context commands for one or more C/C++
	build environments using the trees argument as list of source
	directories.
	
	:param bld: build context 
	:type bld: waflib.Build.BuildContext
	:param trees: top level directories containing projects to build
	:type trees: list
	'''
	if bld.variant:
		libs = bld.env.CCENV[bld.variant]['shlib']
		for lib in libs:
			bld.read_shlib(lib, paths=bld.env.LIBPATH)

	if bld.options.all and not bld.variant:
		if bld.cmd in ('build', 'clean', 'install', 'uninstall', 'codeblocks', 'makefile', 'eclipse'):
			for variant in bld.env.CCENV.keys():
				Scripting.run_command('%s_%s' % (bld.cmd, variant))

	for tree in trees:
		for script in waftools.get_scripts(tree, 'wscript'):
			bld.recurse(script)
예제 #12
0
파일: ccenv.py 프로젝트: m-grabner/jack2
def build(bld, trees=[]):
	'''Performs build context commands for one or more C/C++
	build environments using the trees argument as list of source
	directories.
	
	:param bld: build context 
	:type bld: waflib.Build.BuildContext
	:param trees: top level directories containing projects to build
	:type trees: list
	'''
	if bld.variant:
		libs = bld.env.CCENV[bld.variant]['shlib']
		for lib in libs:
			bld.read_shlib(lib, paths=bld.env.LIBPATH)

	if bld.options.all and not bld.variant:
		if bld.cmd in ('build', 'clean', 'install', 'uninstall', 'codeblocks', 'makefile', 'eclipse'):
			for variant in bld.env.CCENV.keys():
				Scripting.run_command('%s_%s' % (bld.cmd, variant))

	for tree in trees:
		for script in waftools.get_scripts(tree, 'wscript'):
			bld.recurse(script)
예제 #13
0
def waf_entry_point(directory=None):
    import os
    import sys
    import traceback

    import zippy
    import waflib
    from waflib import Logs
    from waflib import Errors
    from waflib import Options
    from waflib import Context
    from waflib import Scripting
    from waflib import Configure
    from waflib import Build

    Logs.init_log()

    directory = os.path.abspath(directory or os.getcwd())
    name = __package__.title()

    Context.WSCRIPT_FILE = 'zscript.py'
    Context.g_module = __import__(__name__)
    Context.g_module.root_path = __file__
    Context.cache_modules[Context.g_module.root_path] = Context.g_module

    Context.launch_dir = directory
    Context.run_dir = directory
    Context.top_dir = directory
    Context.out_dir = directory + os.sep + out
    Context.waf_dir = os.path.abspath(os.path.dirname(waflib.__path__[0]))
    for key in ('update', 'dist', 'distclean', 'distcheck'):
        attr = getattr(Scripting, key)
        if attr.__name__ not in Context.g_module.__dict__:
            setattr(Context.g_module, attr.__name__, attr)
        if key not in Context.g_module.__dict__:
            setattr(Context.g_module, key, attr)

    def pre_recurse(self, node, _pre_recurse=Context.Context.pre_recurse):
        _pre_recurse(self, node)
        if node.abspath() == Context.g_module.root_path:
            self.path = self.root.find_dir(Context.run_dir)

    def recurse(self, dirs, **kwds):
        if Context.run_dir in dirs:
            dirs[dirs.index(Context.run_dir)] = os.path.dirname(__file__)
        _recurse(self, dirs, **kwds)

    _pre_recurse = Context.Context.pre_recurse
    _recurse = Context.Context.recurse
    Context.Context.pre_recurse = pre_recurse
    Context.Context.recurse = recurse

    try:
        os.chdir(Context.run_dir)
    except OSError:
        Logs.error('%s: The directory %r is unreadable' %
                   (name, Context.run_dir))
        return 1

    try:
        Scripting.parse_options()
        Scripting.run_command('init')
        try:
            os.stat(Context.out_dir + os.sep + Build.CACHE_DIR)
        except Exception:
            if 'configure' not in Options.commands:
                Options.commands.insert(0, 'configure')
        while Options.commands:
            cmd_name = Options.commands.pop(0)
            ctx = Scripting.run_command(cmd_name)
            Logs.info('%r finished successfully (%s)' % (
                cmd_name,
                str(ctx.log_timer),
            ))
        Scripting.run_command('shutdown')
    except Errors.WafError as e:
        if Logs.verbose > 1:
            Logs.pprint('RED', e.verbose_msg)
        Logs.error(e.msg)
        return 1
    except SystemExit:
        raise
    except Exception as e:
        traceback.print_exc(file=sys.stdout)
        return 2
    except KeyboardInterrupt:
        Logs.pprint('RED', 'Interrupted')
        return 68

    return 0
예제 #14
0
   derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
"""

import os
import sys

VERSION = "2.0.8"
cwd = os.getcwd()
join = os.path.join

name = sys.argv[0]
base = os.path.dirname(os.path.abspath(name))
wafdir = join(base, ".mywaflib")
sys.path.insert(0, wafdir)

if __name__ == "__main__":
    from waflib import Scripting
    Scripting.waf_entry_point(base, VERSION, wafdir)
예제 #15
0
   derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
"""

import os
import sys

VERSION = "1.9.5"
cwd = os.getcwd()
join = os.path.join

name = sys.argv[0]
base = os.path.dirname(os.path.abspath(name))
wafdir = join(base, '.mywaflib')
sys.path.insert(0, wafdir)

if __name__ == '__main__':
    from waflib import Scripting
    Scripting.waf_entry_point(cwd, VERSION, wafdir)
예제 #16
0
   derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
"""
import os
import sys

VERSION = "2.0.8"
cwd = os.getcwd()
join = os.path.join

name = sys.argv[0]
base = os.path.dirname(os.path.abspath(name))
wafdir = join(base, ".mywaflib")
sys.path.insert(0, wafdir)

if __name__ == "__main__":
    from waflib import Scripting

    Scripting.waf_entry_point(base, VERSION, wafdir)
예제 #17
0
 def run_waf_script(self, build_dir: Path, args: List[str]):
     # First command is ignored since it's probably the python script's path.
     sys.argv = ["waf-light"] + args
     Scripting.waf_entry_point(str(build_dir), VERSION, wafdir)
예제 #18
0
def main():
    Scripting.waf_entry_point(os.getcwd(), Context.WAFVERSION, waf_dir)
예제 #19
0
def distclean(ctx):
    Scripting.distclean(ctx)
    _remove_linguas_file()
   derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
"""

import os
import sys

VERSION = "1.8.14"
cwd = os.getcwd()
join = os.path.join

name = sys.argv[0]
base = os.path.dirname(os.path.abspath(name))
wafdir = join(base, '.mywaflib')
sys.path.insert(0, wafdir)

if __name__ == '__main__':
    from waflib import Scripting
    Scripting.waf_entry_point(cwd, VERSION, wafdir)
예제 #21
0
def distclean(ctx):
    _cleandocs()
    # Now call waf's normal distclean
    Scripting.distclean(ctx)
예제 #22
0
def waf_entry_point(directory=None):
    import os
    import sys
    import traceback

    import zippy
    import waflib
    from waflib import Logs
    from waflib import Errors
    from waflib import Options
    from waflib import Context
    from waflib import Scripting
    from waflib import Configure
    from waflib import Build

    Logs.init_log()

    directory = os.path.abspath(directory or os.getcwd())
    name = __package__.title()

    Context.WSCRIPT_FILE = 'zscript.py'
    Context.g_module = __import__(__name__)
    Context.g_module.root_path = __file__
    Context.cache_modules[Context.g_module.root_path] = Context.g_module

    Context.launch_dir = directory
    Context.run_dir = directory
    Context.top_dir = directory
    Context.out_dir = directory + os.sep + out
    Context.waf_dir = os.path.abspath(os.path.dirname(waflib.__path__[0]))
    for key in ('update', 'dist', 'distclean', 'distcheck'):
        attr = getattr(Scripting, key)
        if attr.__name__ not in Context.g_module.__dict__:
            setattr(Context.g_module, attr.__name__, attr)
        if key not in Context.g_module.__dict__:
            setattr(Context.g_module, key, attr)

    def pre_recurse(self, node, _pre_recurse=Context.Context.pre_recurse):
        _pre_recurse(self, node)
        if node.abspath() == Context.g_module.root_path:
            self.path = self.root.find_dir(Context.run_dir)
    def recurse(self, dirs, **kwds):
        if Context.run_dir in dirs:
            dirs[dirs.index(Context.run_dir)] = os.path.dirname(__file__)
        _recurse(self, dirs, **kwds)
    _pre_recurse = Context.Context.pre_recurse
    _recurse = Context.Context.recurse
    Context.Context.pre_recurse = pre_recurse
    Context.Context.recurse = recurse

    try:
        os.chdir(Context.run_dir)
    except OSError:
        Logs.error('%s: The directory %r is unreadable' % (name, Context.run_dir))
        return 1

    try:
        Scripting.parse_options()
        Scripting.run_command('init')
        try:
            os.stat(Context.out_dir + os.sep + Build.CACHE_DIR)
        except Exception:
            if 'configure' not in Options.commands:
                Options.commands.insert(0, 'configure')
        while Options.commands:
            cmd_name = Options.commands.pop(0)
            ctx = Scripting.run_command(cmd_name)
            Logs.info('%r finished successfully (%s)' % (
                cmd_name, str(ctx.log_timer),
                ))
        Scripting.run_command('shutdown')
    except Errors.WafError as e:
        if Logs.verbose > 1:
            Logs.pprint('RED', e.verbose_msg)
        Logs.error(e.msg)
        return 1
    except SystemExit:
        raise
    except Exception as e:
        traceback.print_exc(file=sys.stdout)
        return 2
    except KeyboardInterrupt:
        Logs.pprint('RED', 'Interrupted')
        return 68

    return 0
예제 #23
0
# This script should run exactly as smith is run.
# E.g. From a folder with a wscript, run:
#  "python <smith repo path>/smith_dev.py configure"
# Launching tested under Linux and Win10

smith_ver = '1.6.8'  # !! MUST match WAFVERSION value in waflib/Context.py !!

# smith_repo is location of waf modules (-> Context.waf_dir)
# cwd is used to find wscript (-> Context.launch_dir)
import sys, os
smith_repo_dir = os.path.dirname(os.path.abspath(sys.argv[0]))
cwd = os.getcwd()
# print("cwd = %s\nsmith_repo = %s\n" % (cwd, smith_repo))

# smithlib and waflib should be under the folder where this script is launched
# smithlib/__init.py__ is not required by the usual smith script
# because smithlib content is copied to waflib/extras
try:
    from smithlib import wsiwaf  # works with local smithlib/__init.py__ file
except:
    # add smithlib to the Python path (though it's not a package)
    sys.path.insert(1, os.path.join(smith_repo_dir, 'smithlib'))
    try:
        import wsiwaf
    except:
        print("smithlib is required on the Python path")
        sys.exit(0)
from waflib import Scripting

Scripting.waf_entry_point(cwd, smith_ver, smith_repo_dir)