Example #1
0
def basecontext():
    "returns the base context"
    if not Path(_options.lockfile).exists():
        return ConfigurationContext
    env = ConfigSet()
    try:
        env.load(_options.lockfile)
    except:  # pylint: disable=bare-except
        return ConfigurationContext
    return BuildContext if (Path(env.out_dir) /
                            'c4che').exists() else ConfigurationContext
Example #2
0
    def __init__(self):
        self.inputs = TestTask.ExperimentNodeList()
        self.outputs = TestTask.ExperimentNodeList()

        self.env = ConfigSet()
        """A ConfigSet to store any attributes.

        ConfigSet is a class defined by waflib which is used as a dictionary to
        store any attributes. Its values can be accessed both by attributes or
        by keys;

        .. code-block:: py

            task = TestTask()
            task.env.FOO = 'test'
            task.env['FOO'] # => 'test'

        """

        self.parameter = {}
        self.source_parameters = []
def mocked_env_b(table_b):
    env = ConfigSet()
    env.table = table_b
    return env
def mocked_env_a(table_a):
    env = ConfigSet()
    env.table = table_a
    return env
Example #5
0
def dist_cmd(ctx, config):
		files_man = []

		parse_version(config)

		if not ctx.options.build_snapshot and not config["NTPS_RELEASE"]:
			ctx.fatal('Please supply --build-snapshot or set config["NTPS_RELEASE"] = True')

		if not config["NTPS_RELEASE"]:
			ctx.fatal('config["NTPS_RELEASE"] must be set to True')

		if exists("build/c4che/host_cache.py"):
			from waflib.ConfigSet import ConfigSet
			cset = ConfigSet()
			cset.load("build/c4che/host_cache.py")
		else:
			ctx.fatal("Please run 'waf configure' first.")

		rev = cset.NTPS_REVISION[:7]
		timestamp = time.strftime("%Y-%m-%d_%H%M%S")

		# XXX: Redo to not use globs.
		bldnode = ctx.path.make_node(config["out"])
		for section in [1, 5, 8]:
			files_man += bldnode.ant_glob("**/*.%d" % section)

		# Need a more reliable check.
		if not files_man:
			ctx.fatal("You must configure and build first with NTPS_RELEASE set to false")

		for man in files_man:
			src = man.abspath()
			dst = src.replace("%s/main/" % bldnode.abspath(), "")
			print "Copying %s -> %s" % (src, dst)
			copyfile(src, dst)

		files = [
			("build/host/ntpd/ntp_parser.tab.c", "ntpd/ntp_parser.tab.c"),
			("build/host/ntpd/ntp_parser.tab.h", "ntpd/ntp_parser.tab.h")
		]

		for src, dst in files:
			if not path.exists(src):
				ctx.fatal("%s doesn't exist please configure and build first.  NTPS_RELEASE must be set to False" % src)
			print "Copying %s -> %s" % (src, dst)
			copyfile(src, dst)

		version = "%d.%d.%d" % (config["NTPS_VERSION_MAJOR"], \
						config["NTPS_VERSION_MINOR"], \
						config["NTPS_VERSION_REV"])


		if ctx.options.build_snapshot:
			ctx.base_name = "ntpsec-%s-%s-%s-snap" % (timestamp, version, rev)
		else:
			ctx.base_name = "ntpsec-%s" % version

		if ctx.options.build_version_tag:
			ctx.base_name = "%s-%s" % (ctx.base_name, ctx.options.build_version_tag)

		if ctx.options.build_snapshot:
			with open("VERSION", "w") as fp:
				fp.write("%s %s %s\n" % (version, timestamp, rev))