def new_config(args=None): if args is None: args = RuntimeStateConfig() return fetch_config(args) else: return args
def setUp(self): self.c = Configuration() self.c.runstate = RuntimeStateConfig() self.task = MapTask() self.task.job = sum self.Task = MapTask self.task.conf = self.c
def setUp(self): self.c = Configuration() self.c.runstate = RuntimeStateConfig() self.c.state['git'] = giza.config.git.GitConfig({}, self.c, os.getcwd()) self.setUpClasses() self.create_data()
def main(): """ The main entry point, as specified in the ``setup.py`` file. Adds commands from other subsidiary entry points (specified in the ``commands`` variable above,) and then uses ``arch.dispatch()`` to start the process. The ``RuntimeStateConfig()`` object is created here and handed to the parser as the object that will recive all command line data, rather than using a standard argparse namespace object. This allows all runtime argument parsing to happen inside of these config objects rather than spread among all of the entry points. This function catches and recovers from :exc:`KeyboardInterupt` which means that doesn't dump a stack trace following a Control-C. """ parser = get_base_parser() for namespace, entry_points in commands.items(): if namespace == 'main': argh.add_commands(parser, entry_points) else: argh.add_commands(parser, entry_points, namespace=namespace) args = RuntimeStateConfig() try: argh.dispatch(parser, namespace=args) except KeyboardInterrupt: logger.error('operation interrupted by user.')
def test_configuration_object_validation_acceptance(self): for i in [self.c, Configuration(), RuntimeStateConfig()]: t = self.Task() self.assertIsNone(t.conf) t.conf = i self.assertIs(i, t.conf)
def setUp(self): self.c = Configuration() self.c.runstate = RuntimeStateConfig() self.c.paths = {'includes': os.path.join(os.path.abspath(os.path.dirname(__file__)), 'data-inheritance')} self.DataCache = DataCache self.create_data()
def new_skeleton_config(conf=None): if conf is None: conf = Configuration() args = RuntimeStateConfig() conf.runstate = args return conf else: return conf
def setUp(self): self.c = Configuration() self.c.runstate = RuntimeStateConfig() self.c.paths = {'includes': get_test_file_path()} self.DataContentBase = DataContentBase self.DataCache = DataCache self.create_data()
def setUp(self): self.c = Configuration() self.c.runstate = RuntimeStateConfig() self.c.paths = { 'includes': os.path.join(os.path.abspath(os.path.dirname(__file__)), 'data-inheritance') } self.data = DummyCache([], self.c)
def new_config(args=None): if args in (None, True, False): args = RuntimeStateConfig() return fetch_config(args) elif isinstance(args, RuntimeStateConfig): return fetch_config(args) elif isinstance(args, Configuration): return args else: raise ConfigurationError
def main(): try: from giza.config.helper import fetch_config from giza.config.runtime import RuntimeStateConfig conf = fetch_config(RuntimeStateConfig()) except: conf = get_conf() m = generate_meta(conf) m.write(sys.argv[1]) print('[meta-build]: built "' + sys.argv[1] + '" to seed build metadata.')
def main(): parser = get_base_parser() for namespace, entry_points in commands.items(): if namespace == 'main': argh.add_commands(parser, entry_points) else: argh.add_commands(parser, entry_points, namespace=namespace) args = RuntimeStateConfig() try: argh.dispatch(parser, namespace=args) except KeyboardInterrupt: logger.error('operation interrupted by user.')
def setUp(self): self.c = Configuration() self.c.runstate = RuntimeStateConfig() self.c.paths = {'includes': 'data-inheritance', 'projectroot': os.path.abspath(os.path.dirname(__file__))} self.DataContentBase = DataContentBase self.DataCache = DataCache self.InheritableContentBase = InheritableContentBase self.dummy_doc = {'ref': 'dummy-doc', 'pre': 'pre text'} self.create_data()
def new_skeleton_config(conf=None): if conf is None: conf = Configuration() args = RuntimeStateConfig() conf.runstate = args try: register_content_generators(conf) except KeyError: logger.warning("cannot register content generators") return conf else: return conf
def setUp(self): self.c = Configuration() self.c.runstate = RuntimeStateConfig() self.c.paths = { 'includes': os.path.join(os.path.abspath(os.path.dirname(__file__)), 'data-inheritance') } self.content_fn = get_inheritance_data_files()[0] self.data = DummyCache([], self.c) self.data.ingest([self.content_fn]) self.content = self.data.cache[self.content_fn]
def new_skeleton_config(conf=None): if conf is None: conf = Configuration() args = RuntimeStateConfig() conf.runstate = args try: register_content_generators(conf) except KeyError: logger.warning("trouble registering content generators") return conf elif isinstance(conf, RuntimeStateConfig): return fetch_config(conf) else: return conf
def runstate(self, value): if isinstance(value, RuntimeStateConfig): if 'runstate' in self.state: self.state['runstate'].state.update(value.state) else: value.conf = self self.state['runstate'] = value elif isinstance(value, dict): if 'runstate' in self.state: self.state['runstate'].ingest(value) else: runtime = RuntimeStateConfig(value) runtime.conf = self self.state['runstate'] = runtime elif value is None: runtime = RuntimeStateConfig() runtime.conf = self self.state['runstate'] = runtime else: msg = "invalid runtime state" logger.critical(msg) raise TypeError(msg)
# # MongoDB documentation build configuration file, created by # sphinx-quickstart on Mon Oct 3 09:58:40 2011. # # This file is execfile()d with the current directory set to its containing dir. import sys import os import datetime from sphinx.errors import SphinxError from giza.config.runtime import RuntimeStateConfig from giza.config.helper import fetch_config, get_versions, get_manual_path conf = fetch_config(RuntimeStateConfig()) sconf = conf.system.files.data.sphinx_local sys.path.append( os.path.join(conf.paths.projectroot, conf.paths.buildsystem, 'sphinxext')) try: tags except NameError: class Tags(object): def has(self, *args): return False tags = Tags()
def setUp(self): self.c = Configuration() self.c.runstate = RuntimeStateConfig() self.app = BuildApp(self.c)
def setUp(self): self.c = Configuration() self.c.runstate = RuntimeStateConfig() self.app = BuildApp(self.c) self.app.default_pool = random.choice(['serial', 'thread']) self.app.pool_size = 2
def setUp(self): self.c = Configuration() self.c.runstate = RuntimeStateConfig() self.InheritableContentBase = InheritableContentBase self.create_data()
def setUp(self): self.c = Configuration() self.c.runstate = RuntimeStateConfig() self.data = DummyRecord({}, self.c) self.data.replacement = {'state': 'foo'}