def test_setup_not_exists(tmp_path, setup_steps): """ GIVEN WHEN setup is called THEN the build folder is created and empty. """ setup_steps(tmp_path) returned_path = app.setup(str(tmp_path)) assert str(returned_path) == str(tmp_path / "build") assert returned_path.exists() assert next(returned_path.glob("**/*"), None) is None
from definitions import Definitions import cache import sandbox import sandboxlib print('') if not os.path.exists('./VERSION'): if os.path.basename(os.getcwd()) != 'definitions': if os.path.isdir(os.path.join(os.getcwd(), 'definitions')): os.chdir(os.path.join(os.getcwd(), 'definitions')) else: if os.path.isdir(os.path.join(os.getcwd(), '..', 'definitions')): os.chdir(os.path.join(os.getcwd(), '..', 'definitions')) app.setup(sys.argv) app.cleanup(app.config['tmp']) with app.timer('TOTAL'): tmp_lock = open(os.path.join(app.config['tmp'], 'lock'), 'r') fcntl.flock(tmp_lock, fcntl.LOCK_SH | fcntl.LOCK_NB) target = os.path.join(app.config['defdir'], app.config['target']) app.log('TARGET', 'Target is %s' % target, app.config['arch']) with app.timer('DEFINITIONS', 'parsing %s' % app.config['def-version']): defs = Definitions() with app.timer('CACHE-KEYS', 'cache-key calculations'): cache.cache_key(defs, app.config['target']) cache.cull(app.config['artifacts']) target = defs.get(app.config['target'])
import app.setup import util.setup import pyspider.setup import gui.setup gui_scripts = [] console_scripts = [] console_scripts.extend(["ara-"+script for script in app.setup.console_scripts]) console_scripts.extend(["ara-"+script for script in util.setup.console_scripts]) console_scripts.extend(["sp-"+script for script in pyspider.setup.console_scripts]) gui_scripts.extend(["ara-"+script for script in gui.setup.gui_scripts]) def configuration(parent_package='',top_path=None): from numpy.distutils.misc_util import Configuration config = Configuration('arachnid', parent_package, top_path) config.set_options(quiet=True) #config.add_subpackage('app') #config.add_subpackage('pyspider') #config.add_subpackage('util') config.add_subpackage('core') return config if __name__ == '__main__': from numpy.distutils.core import setup setup(**configuration(top_path='').todict())
sys.exit(1) target = sys.argv[1] if len(sys.argv) == 3: arch = sys.argv[2] else: arch = platform.machine() if arch in ('mips', 'mips64'): if arch == 'mips': arch = 'mips32' if sys.byteorder == 'big': arch = arch + 'b' else: arch = arch + 'l' with app.setup(target, arch): with app.timer('TOTAL', 'ybd starts, version %s' % app.settings['ybd-version']): app.log('TARGET', 'Target is %s' % os.path.join(app.settings['defdir'], target), arch) with app.timer('DEFINITIONS', 'Parsing %s' % app.settings['def-ver']): defs = Definitions() with app.timer('CACHE-KEYS', 'Calculating'): cache.get_cache(defs, app.settings['target']) defs.save_trees() sandbox.executor = sandboxlib.executor_for_platform() app.log(target, 'Using %s for sandboxing' % sandbox.executor) assemble(defs, app.settings['target']) deploy(defs, app.settings['target'])
from deployment import deploy from definitions import Definitions import cache import sandbox import sandboxlib print('') if not os.path.exists('./VERSION'): if os.path.basename(os.getcwd()) != 'definitions': if os.path.isdir(os.path.join(os.getcwd(), 'definitions')): os.chdir(os.path.join(os.getcwd(), 'definitions')) else: if os.path.isdir(os.path.join(os.getcwd(), '..', 'definitions')): os.chdir(os.path.join(os.getcwd(), '..', 'definitions')) app.setup(sys.argv) app.cleanup(app.config['tmp']) with app.timer('TOTAL'): tmp_lock = open(os.path.join(app.config['tmp'], 'lock'), 'r') fcntl.flock(tmp_lock, fcntl.LOCK_SH | fcntl.LOCK_NB) target = os.path.join(app.config['defdir'], app.config['target']) app.log('TARGET', 'Target is %s' % target, app.config['arch']) with app.timer('DEFINITIONS', 'parsing %s' % app.config['def-version']): defs = Definitions() with app.timer('CACHE-KEYS', 'cache-key calculations'): cache.cache_key(defs, app.config['target']) cache.cull(app.config['artifacts']) target = defs.get(app.config['target'])
from app import setup app = setup() if __name__ == '__main__': app.run()
import util.setup import pyspider.setup import gui.setup gui_scripts = [] console_scripts = [] console_scripts.extend( ["ara-" + script for script in app.setup.console_scripts]) console_scripts.extend( ["ara-" + script for script in util.setup.console_scripts]) console_scripts.extend( ["sp-" + script for script in pyspider.setup.console_scripts]) gui_scripts.extend(["ara-" + script for script in gui.setup.gui_scripts]) def configuration(parent_package='', top_path=None): from numpy.distutils.misc_util import Configuration config = Configuration('arachnid', parent_package, top_path) config.set_options(quiet=True) #config.add_subpackage('app') #config.add_subpackage('pyspider') #config.add_subpackage('util') config.add_subpackage('core') return config if __name__ == '__main__': from numpy.distutils.core import setup setup(**configuration(top_path='').todict())
component = defs.get(it) if component.get('repo'): log('AGGREGATE', 'Adding aggregate for', component['name']) aggregate += [{'get': component['name']}] else: log('PASSED', 'Adding passed for', component['name']) aggregate += [{'get': component['name']}] passed += [component['name']] plan = [{'task': 'Build', 'config': config}, {'aggregate': aggregate}] job = {'name': target['name'], 'plan': plan, 'passed': passed} pipeline = {'resources': inputs(defs, target), 'jobs': [job]} output = './pipeline.yml' with open(output, 'w') as f: f.write(yaml.dump(pipeline, default_flow_style=False)) exit('CONCOURSE', 'pipeline is at', output) setup(sys.argv) with timer('TOTAL'): target = os.path.join(config['defdir'], config['target']) log('TARGET', 'Target is %s' % target, config['arch']) with timer('DEFINITIONS', 'parsing %s' % config['def-version']): defs = Definitions() with timer('CACHE-KEYS', 'cache-key calculations'): cache.cache_key(defs, config['target']) write_pipeline(defs, config['target'])
import app import thread (loop, ui) = app.setup() # Spawn thread for running app in background thread.start_new_thread(app.run, (loop, ui)) # Urwid requires being on main thread loop.run()
def update_a(): setup()
def setUp(self): app.setup('config/test_config.py')
for kind in ['systems', 'strata', 'chunks']: log('COUNT', '%s has %s %s' % (config['target'], config[kind], kind)) log('RESULT', 'Cache-key for target is at', config['result-file']) print('') original_cwd = os.getcwd() if not os.path.exists('./VERSION'): if os.path.basename(os.getcwd()) != 'definitions': if os.path.isdir(os.path.join(os.getcwd(), 'definitions')): os.chdir(os.path.join(os.getcwd(), 'definitions')) else: if os.path.isdir(os.path.join(os.getcwd(), '..', 'definitions')): os.chdir(os.path.join(os.getcwd(), '..', 'definitions')) setup(sys.argv, original_cwd) cleanup(config['tmp']) with timer('TOTAL'): tmp_lock = open(os.path.join(config['tmp'], 'lock'), 'r') fcntl.flock(tmp_lock, fcntl.LOCK_SH | fcntl.LOCK_NB) target = os.path.join(config['defdir'], config['target']) log('TARGET', 'Target is %s' % target, config['arch']) with timer('DEFINITIONS', 'parsing %s' % config['def-version']): app.defs = Pots() target = app.defs.get(config['target']) if config.get('mode', 'normal') == 'parse-only': Pipeline(target) os._exit(0)
#!/usr/bin/env python from app import run, setup, app setup(app) if __name__ == '__main__': run(app)
if os.path.isdir(os.path.join(os.getcwd(), 'definitions')): os.chdir(os.path.join(os.getcwd(), 'definitions')) else: if os.path.isdir(os.path.join(os.getcwd(), '..', 'definitions')): os.chdir(os.path.join(os.getcwd(), '..', 'definitions')) description = 'Build and manipulate YAML build definitions' parser = argparse.ArgumentParser(description=description) parser.add_argument('-m', '--mode', type=str, default=None, choices=['parse-only', 'keys-only', 'no-build', 'normal'], help='Operation mode') parser.add_argument('target', help='The target definition') parser.add_argument('arch', help='The target architecture') args = parser.parse_args() setup(sys.argv[0], args.target, args.arch, args.mode, original_cwd) cleanup(config['tmp']) with timer('TOTAL'): tmp_lock = open(os.path.join(config['tmp'], 'lock'), 'r') fcntl.flock(tmp_lock, fcntl.LOCK_SH | fcntl.LOCK_NB) target = os.path.join(config['defdir'], config['target']) log('TARGET', 'Target is %s' % target, config['arch']) with timer('DEFINITIONS', 'parsing %s' % config['def-version']): app.defs = Pots() target = app.defs.get(config['target']) if config.get('mode', 'normal') == 'parse-only': Pipeline(target) os._exit(0)
# This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License along # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # # =*= License: GPL-2 =*= '''A module to build a definition.''' import os import sys from definitions import Definitions import cache import app from assembly import assemble import sandbox target = os.path.splitext(os.path.basename(sys.argv[1]))[0] arch = sys.argv[2] with app.setup(target, arch): with app.timer('TOTAL', 'YBD starts'): defs = Definitions() definition = defs.get(target) with app.timer('CACHE-KEYS', 'Calculating'): cache.get_cache(target) defs.save_trees() assemble(definition)