def create_context(opts): # Setup build_pkg common context context = Context() context.source_space = os.path.abspath(os.path.normpath(opts.path)) context.package_manifest = __get_cached_package_manifest(opts.path) pkg_name = context.package_manifest.name context.build_space = os.path.join(opts.build_space, pkg_name) context.install_space = opts.install_space context.build_dependencies = opts.build_dependencies \ if 'build_dependencies' in opts else [] print('') print("Process package '{0}' with context:".format(pkg_name)) print("-" * 80) keys = [ 'source_space', 'build_space', ] max_key_len = str(max([len(k) for k in keys])) for key in keys: value = context[key] if isinstance(value, list): value = ", ".join(value) if value else "None" print(("{0:>" + max_key_len + "} => {1}").format(key, value)) print("-" * 80) return context
def create_context(opts): # Setup build_pkg common context context = Context() context.source_space = os.path.abspath(os.path.normpath(opts.path)) context.package_manifest = _get_cached_package_manifest(opts.path) pkg_name = context.package_manifest.name context.build_space = os.path.join(opts.build_space, pkg_name) context.install_space = opts.install_space context.install = True context.build_dependencies = opts.build_dependencies \ if 'build_dependencies' in opts else [] context.exec_dependency_paths_in_workspace = opts.exec_dependency_paths_in_workspace \ if 'exec_dependency_paths_in_workspace' in opts else [] context.symlink_install = opts.symlink_install context.make_flags = opts.make_flags context.dry_run = False context.build_tests = opts.build_tests context.python_interpreter = opts.python_interpreter print('') print("Process package '{0}' with context:".format(pkg_name)) print('-' * 80) keys = [ 'source_space', 'build_space', 'install_space', 'make_flags', 'build_tests', ] max_key_len = str(max(len(k) for k in keys)) for key in keys: value = context[key] if isinstance(value, list): value = ', '.join(value) if value else 'None' print(('{0:>' + max_key_len + '} => {1}').format(key, value)) print('-' * 80) # Load up build type plugin class build_type = get_build_type(opts.path) build_type_impl = get_class_for_build_type(build_type)() # Allow the build type plugin to process options into a context extender ce = build_type_impl.extend_context(opts) # Extend the context with the context extender ce.apply_to_context(context) return context