def install_7z(): if not SevenZ.seven_z_built: install_module = LibraryModule('7z', {'rebuild': True}) install_module.prepare() SevenZ.seven_z_build = True SevenZ.seven_z_path = install_module.write_results()['path'] return SevenZ.seven_z_path
def install_cmake(): if not Cmake.cmake_built: install_module = LibraryModule('cmake', {'rebuild': False, 'version': config.cmakeVersion}) install_module.prepare() Cmake.cmake_built = True Cmake.cmake_path = install_module.write_results()['path'] return Cmake.cmake_path
def require_module(module_name, conf=False): if not conf: conf = config.dependencies[ module_name] if module_name in config.dependencies else {} dependend_module = LibraryModule(module_name, conf) dependend_module.prepare() results = dependend_module.write_results() LibraryModule.flush_results() return results
def require_module(module_name, conf=False): if not conf: conf = config.dependencies[module_name] if module_name in config.dependencies else {} dependend_module = LibraryModule(module_name, conf) dependend_module.prepare() results = dependend_module.write_results() LibraryModule.flush_results() return results
def __build_dependency(depend_name): library_module = LibraryModule(depend_name, config.dependencies[depend_name]) library_module.prepare() library_module.write_results()
def exec_command(): if len(sys.argv) < 3: print(help_message) sys.exit(1) command = sys.argv[2] modules = sys.argv[3::] if command == 'install': for module_name in modules: if LibraryModule.module_exists(module_name): print('Module "{}" already in system. Skipping'.format(module_name)) continue module_params = repos.find_module(module_name) if not bool(module_params): print('Module "{}" wasnt\'t found'.format(module_name)) continue module_repo = module_params['repo'] module_dir = sys_config.modules_location.format(module_name=module_name) vcs.git_clone(module_repo, module_dir) print('----- Module {} was successfully installed'.format(module_name)) sys.exit(0) elif command == 'delete': for module_name in modules: if LibraryModule.module_exists(module_name): fs.remove(LibraryModule.get_module_location(module_name)) sys.exit(0) elif command == 'list': modules_dir = os.path.join('core', 'modules') modules = [o for o in os.listdir(modules_dir) if o != '__pycache__' and os.path.isdir(os.path.join(modules_dir, o))] print(" , ".join(modules)) sys.exit(0) elif command == 'is_built': for module_name in modules: module = LibraryModule(module_name, {'rebuild': False}) print(module_name + " - " + ("Not built" if str(module.module_need_rebuild()) else "Built")) sys.exit(1) elif command == 'build': params = sys.argv[4::] building_params = {'rebuild': True} for param in params: param = param.split('=') if len(param) < 2: continue key = param[0] value = '='.join(param[1::]) building_params[key] = value module_name = modules[0] module = LibraryModule(module_name, building_params) module.prepare() elif command == 'show_results': module_name = modules[0] module = LibraryModule(module_name, {'rebuild': False}) module.prepare() print(module.write_results()) elif command == 'exists': for module_name in modules: print(module_name + " - " + ("Exists" if LibraryModule.module_exists(module_name) else "No module")) else: print(help_message) sys.exit(1)