Ejemplo n.º 1
0
    def setUp(self):
        self.funcs = {
            'dumb': dummy_function,
            'dump_new': dump_args_to_json_file_with_newlines,
            'dump': dump_args_to_json_file,
            'shell': subprocess.call
        }

        self.bsg = BuildSystemGenerator(self.funcs)
        self.bsg.check_method = 'force'

        self.complex_jobs = [{
            'target': 'a',
            'dep': ['b', 'f', 'r'],
            'job': 'dumb',
            'args': [None, None]
        }, {
            'target': 'b',
            'dep': ['c', 'l'],
            'job': 'dumb',
            'args': [None, None]
        }, {
            'target': 'c',
            'dep': ['r', 'l'],
            'job': 'dumb',
            'args': [None, None]
        }, {
            'target': 'r',
            'dep': [],
            'job': 'dumb',
            'args': [None, None]
        }, {
            'target': 'f',
            'dep': [],
            'job': 'dumb',
            'args': [None, None]
        }, {
            'target': 'l',
            'dep': [],
            'job': 'dumb',
            'args': [None, None]
        }]

        self.simple_jobs = [{
            'target': 'a',
            'dep': 'b',
            'job': 'dumb',
            'args': [None, None]
        }, {
            'target': 'b',
            'dep': 'c',
            'job': 'dumb',
            'args': [None, None]
        }, {
            'target': 'c',
            'dep': [],
            'job': 'dumb',
            'args': [None, None]
        }]
Ejemplo n.º 2
0
    def setUp(self):
        self.bsg = BuildSystemGenerator()

        self.funcs = {
            'dumb': dummy_function,
            'dump_new': dump_args_to_json_file_with_newlines,
            'dump': dump_args_to_json_file
        }
Ejemplo n.º 3
0
 def setUp(self):
     self.bsg = BuildSystemGenerator()
     self.ex_args = {
         'cmd': 'go',
         'cwd': '/tmp/test',
         'args': ['test', 'true']
     }
     self.expected = (subprocess.call, self.ex_args)
Ejemplo n.º 4
0
    def setUp(self):
        self.bsg = BuildSystemGenerator()

        self.sequence = BuildSequence()

        self.funcs = {
            'dumb': dummy_function,
            'dump_new': dump_args_to_json_file_with_newlines,
            'dump': dump_args_to_json_file,
            'shell': subprocess.call
        }
Ejemplo n.º 5
0
    def test_ingestion_simple(self):
        self.simple_system()
        self.bsg.finalize()
        procedural = sorted(self.bsg.specs.keys())

        second = BuildSystemGenerator(self.bsg.funcs)
        second.ingest(self.simple_jobs)
        second.finalize()
        ingested = sorted(second.specs.keys())

        self.assertEqual(procedural, ingested)
Ejemplo n.º 6
0
    def setUp(self):
        self.bsg = BuildSystemGenerator()
        self.bsg.add_task('dumb', dummy_function)
        self.bsg.add_task('dumb_json', dump_args_to_json_file)
        self.bsg.add_task('dumb_json_newline',
                          dump_args_to_json_file_with_newlines)
        self.bsg.add_task('shell', subprocess.call)

        self.funcs = {
            'dumb': dummy_function,
            'dump_json_newline': dump_args_to_json_file_with_newlines,
            'shell': subprocess.call,
            'dumb_json': dump_args_to_json_file
        }

        self.strings = {'is': 'is not', 'can': 'cannot'}
Ejemplo n.º 7
0
def stages(jobs, stages, file, check):
    """
    Main public function to generate and run a
    :class:`~system.BuildSystemGenerator()` build system.
    """

    if os.path.isdir('buildc') or os.path.exists('buildc.py'):
        try:
            from buildc import functions
        except ImportError:
            from buildc import funcs as functions
        else:
            functions = None
    else:
        functions = None

    strings = _import_strings()
    bsg = BuildSystemGenerator(functions)
    bsg.check_method = check

    if functions is None:
        logger.info('no python functions pre-loaded')

    for fn in file:
        if fn.endswith('json'):
            bsg.ingest_json(fn, strings)
        elif fn.endswith('yaml') or fn.endswith('yml'):
            bsg.ingest_yaml(fn, strings)
        else:
            logger.warning('format of {0} is unclear, not parsing'.format(fn))

    bsg.finalize()
    bsg.system.workers(jobs)

    if not stages:
        bsg.system.run()
    else:
        bsg = narrow_buildsystem(stages, bsg.system)
        bsg.system.workers(jobs)
        bsg.run()
Ejemplo n.º 8
0
 def test_initiation_funcs_initialized_tuple(self):
     func = ('a', dummy_function)
     bs = BuildSystemGenerator(func)
     self.assertEqual(bs.funcs, {})
Ejemplo n.º 9
0
 def test_initiation_funcs_initialized(self):
     func = {'a': dummy_function}
     bs = BuildSystemGenerator(func)
     self.assertEqual(bs.funcs, func)
Ejemplo n.º 10
0
 def setUp(self):
     self.bsg = BuildSystemGenerator()