コード例 #1
0
ファイル: helper.py プロジェクト: rawfalafel/docs-tools
def new_config(args=None):
    if args is None:
        args = RuntimeStateConfig()

        return fetch_config(args)
    else:
        return args
コード例 #2
0
 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
コード例 #3
0
 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()
コード例 #4
0
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.')
コード例 #5
0
    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)
コード例 #6
0
    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()
コード例 #7
0
ファイル: helper.py プロジェクト: rawfalafel/docs-tools
def new_skeleton_config(conf=None):
    if conf is None:
        conf = Configuration()
        args = RuntimeStateConfig()
        conf.runstate = args

        return conf
    else:
        return conf
コード例 #8
0
    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()
コード例 #9
0
    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)
コード例 #10
0
ファイル: helper.py プロジェクト: isabella232/docs-tools-1
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
コード例 #11
0
ファイル: meta.py プロジェクト: rawfalafel/docs-tools
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.')
コード例 #12
0
ファイル: cmdline.py プロジェクト: rawfalafel/docs-tools
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.')
コード例 #13
0
    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()
コード例 #14
0
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
コード例 #15
0
    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]
コード例 #16
0
ファイル: helper.py プロジェクト: isabella232/docs-tools-1
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
コード例 #17
0
ファイル: main.py プロジェクト: isabella232/docs-tools-1
 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)
コード例 #18
0
#
# 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()
コード例 #19
0
ファイル: test_app.py プロジェクト: banlyst/docs-tools
 def setUp(self):
     self.c = Configuration()
     self.c.runstate = RuntimeStateConfig()
     self.app = BuildApp(self.c)
コード例 #20
0
ファイル: test_app.py プロジェクト: tychoish/libgiza
 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
コード例 #21
0
    def setUp(self):
        self.c = Configuration()
        self.c.runstate = RuntimeStateConfig()
        self.InheritableContentBase = InheritableContentBase

        self.create_data()
コード例 #22
0
    def setUp(self):
        self.c = Configuration()
        self.c.runstate = RuntimeStateConfig()

        self.data = DummyRecord({}, self.c)
        self.data.replacement = {'state': 'foo'}