def main(args): deps = args.deps or [d for d in all_deps if not has_pkg(d)] if not deps: print( 'All dependencies already built, if you want to re-build, use the --clean option' ) raise SystemExit(0) for dep in deps: if dep not in all_deps: raise SystemExit('%s is an unknown dependency' % dep) set_title('Downloading...') download(deps) other_deps = frozenset(all_deps) - frozenset(deps) dest_dir = init_env(other_deps) while deps: dep = deps.pop(0) ok = False try: build(dep, args, dest_dir) ok = True finally: if not ok: deps.insert(0, dep) if deps: print('Remaining deps:', ' '.join(deps)) # After a successful build, remove the unneeded sw dir rmtree(dest_dir)
def build(dep, args, dest_dir): set_title('Building ' + dep) owd = os.getcwdu() set_current_source(filename_for_dep(dep)) output_dir = todir = mkdtemp(prefix=dep + '-') set_build_dir(output_dir) try: m = importlib.import_module('pkgs.' + dep) except ImportError: if os.path.exists(os.path.join(os.path.dirname(os.path.abspath(__file__)), dep + '.py')): raise m = None tsdir = extract_source() try: if hasattr(m, 'main'): m.main(args) else: simple_build() if isosx: fix_install_names(m, output_dir) except Exception: import traceback traceback.print_exc() print('\nDropping you into a shell') sys.stdout.flush(), sys.stderr.flush() run_shell() raise SystemExit(1) create_package(m, output_dir, pkg_path(dep)) install_package(pkg_path(dep), dest_dir) if hasattr(m, 'post_install_check'): m.post_install_check() os.chdir(owd) rmtree(todir) rmtree(tsdir)
def main(args): deps = args.deps or [d for d in all_deps if not has_pkg(d)] if not deps: print('All dependencies already built, if you want to re-build, use the --clean option') raise SystemExit(0) for dep in deps: if dep not in all_deps: raise SystemExit('%s is an unknown dependency' % dep) set_title('Downloading...') download(deps) other_deps = frozenset(all_deps) - frozenset(deps) dest_dir = init_env(other_deps) while deps: dep = deps.pop(0) ok = False try: build(dep, args, dest_dir) ok = True finally: if not ok: deps.insert(0, dep) if deps: print('Remaining deps:', ' '.join(deps)) # After a successful build, remove the unneeded sw dir rmtree(dest_dir)
def build(dep, args, dest_dir): set_title('Building ' + dep) owd = os.getcwdu() set_current_source(filename_for_dep(dep)) output_dir = todir = mkdtemp(prefix=dep + '-') set_build_dir(output_dir) idep = dep.replace('-', '_') try: m = importlib.import_module('pkgs.' + idep) except ImportError: if os.path.exists(os.path.join(os.path.dirname(os.path.abspath(__file__)), idep + '.py')): raise m = None tsdir = extract_source() try: if hasattr(m, 'main'): m.main(args) else: if dep in python_deps: python_build() output_dir = os.path.join(output_dir, os.path.basename(SW), os.path.basename(PREFIX)) else: simple_build() if isosx: fix_install_names(m, output_dir) except Exception: import traceback traceback.print_exc() print('\nDropping you into a shell') sys.stdout.flush(), sys.stderr.flush() run_shell() raise SystemExit(1) create_package(m, output_dir, pkg_path(dep)) install_package(pkg_path(dep), dest_dir) if hasattr(m, 'post_install_check'): m.post_install_check() os.chdir(owd) rmtree(todir) rmtree(tsdir)