def install_scripts(install_root): sdk.print_box('Installing configure.py and sdk.py to:', install_root) shutil.copyfile(os.path.join(HERE, 'configure.py'), os.path.join(install_root, 'configure.py')) shutil.copyfile(os.path.join(HERE, 'sdk.py'), os.path.join(install_root, 'sdk.py'))
def merge(layout): merge_dir = os.path.join(HERE, 'merge') if os.path.isdir(merge_dir): sdk.print_box('Merging %s' % merge_dir, 'into', layout['root']) sdk.copy_tree(merge_dir, layout['root']) else: print('No files to merge.')
def check_source_dir(glob_pattern): sdk.print_box("Sources discovery for %r..." % glob_pattern) sources_pattern = os.path.join(HERE, 'sources', glob_pattern) sources_pattern_platform = os.path.join(sdk.platform_root('sources'), glob_pattern) globs = glob.glob(sources_pattern) + glob.glob(sources_pattern_platform) candidates = [d for d in globs if os.path.isdir(d)] if len(candidates) == 1: return candidates[0] elif len(candidates) > 1: argparse.ArgumentTypeError( "Too many candidates for %s: %s" % (glob_pattern, ", ".join(candidates))) else: argparse.ArgumentTypeError("%r not found, provide an existing folder" % glob_pattern)
def check_source_dir(glob_pattern): sdk.print_box("Sources discovery for %r..." % glob_pattern) sources_pattern = os.path.join(HERE, 'sources', glob_pattern) sources_pattern_platform = os.path.join(sdk.platform_root('sources'), glob_pattern) globs = glob.glob(sources_pattern) + glob.glob( sources_pattern_platform) candidates = [d for d in globs if os.path.isdir(d)] if len(candidates) == 1: return candidates[0] elif len(candidates) > 1: argparse.ArgumentTypeError("Too many candidates for %s: %s" % (glob_pattern, ", ".join(candidates))) else: argparse.ArgumentTypeError( "%r not found, provide an existing folder" % glob_pattern)
def install_scripts(install_root): sdk.print_box('Installing configure.py and sdk.py to:', install_root) shutil.copyfile( os.path.join(HERE, 'configure.py'), os.path.join(install_root, 'configure.py')) shutil.copyfile(os.path.join(HERE, 'sdk.py'), os.path.join(install_root, 'sdk.py'))
def build(recipes, layout, debug, profile): for pkg, build_f, src_dir in recipes: sdk.print_box('Building %s' % pkg, src_dir) with sdk.chdir(src_dir): build_f(layout, debug, profile)