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)
def build(module_params): check_dependencies(False, ['version'], module_params) fs.remove(origin_dir) sqlite_url = 'http://www.sqlite.org/2015/sqlite-amalgamation-{0}.zip'.format(module_params['version']) net.download_file(sqlite_url, archive_path) archives.extract_zip(archive_path) fs.remove(archive_path) fs.rename('sqlite-amalgamation*', origin_dir, True) create_and_run_cmake_file(origin_dir, 'x86') create_and_run_cmake_file(origin_dir, 'x64') if is_windows(): assembly.build_vcxproj(os.path.abspath(os.path.join(origin_dir, 'sqlite_x86', 'sqlite_x86.vcxproj')), lib_directory, ('Debug', 'Release')) assembly.build_vcxproj(os.path.abspath(os.path.join(origin_dir, 'sqlite_x64', 'sqlite_x64.vcxproj')), lib_directory, ('Debug', 'Release')) fs.move_files_to_dir_by_mask(os.path.join(origin_dir, '*.h'), headers_dir, True) fs.clear(origin_dir, cleanup_extensions['c++'])
def build(module_params): fs.remove("log") fs.remove("temp") shasums_url = "https://nodejs.org/dist/latest/SHASUMS256.txt" path_to_shasums = net.download_file(shasums_url) with open(path_to_shasums) as shasums_file: line = shasums_file.readline() match = re.search("node-v((\d.?)+?)-", line) latest_version = match.group(1) node_archive = net.download_file("https://nodejs.org/dist/latest/node-v{0}.tar.gz".format(latest_version)) archives.extract_tar(node_archive, "temp") fs.rename("./temp/node-*", "./temp/node_src", True) assembly.configure("temp/node_src/", {}, []) try: assembly.make("temp/node_src/") except Exception as e: exc_type, exc_obj, exc_tb = sys.exc_info() fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1] print("Error while building nginx: '{0}' in {1}:{2} ".format(e, fname, exc_tb.tb_lineno), file=sys.stderr) print("Make log: ", os.path.abspath('log/make.txt')) sys.exit(1) try: assembly.make_install("temp/node_src/") except Exception as e: exc_type, exc_obj, exc_tb = sys.exc_info() fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1] print("Error while building nginx: '{0}' in {1}:{2} ".format(e, fname, exc_tb.tb_lineno), file=sys.stderr) print("Make log: ", os.path.abspath('log/make_install.txt')) sys.exit(1) fs.remove("temp")
def build(module_params): check_dependencies(False, ['version'], module_params) fs.remove(origin_dir) sqlite_url = 'http://www.sqlite.org/2015/sqlite-amalgamation-{0}.zip'.format( module_params['version']) net.download_file(sqlite_url, archive_path) archives.extract_zip(archive_path) fs.remove(archive_path) fs.rename('sqlite-amalgamation*', origin_dir, True) create_and_run_cmake_file(origin_dir, 'x86') create_and_run_cmake_file(origin_dir, 'x64') if is_windows(): assembly.build_vcxproj( os.path.abspath( os.path.join(origin_dir, 'sqlite_x86', 'sqlite_x86.vcxproj')), lib_directory, ('Debug', 'Release')) assembly.build_vcxproj( os.path.abspath( os.path.join(origin_dir, 'sqlite_x64', 'sqlite_x64.vcxproj')), lib_directory, ('Debug', 'Release')) fs.move_files_to_dir_by_mask(os.path.join(origin_dir, '*.h'), headers_dir, True) fs.clear(origin_dir, cleanup_extensions['c++'])
def build(module_params): fs.remove("log") fs.remove("temp") download_openssl(module_params['openssl_version']) download_nginx(module_params['version']) download_pcre(module_params['pcre_version']) download_zlib(module_params['zlib_version']) configure() make() copy_init_d_script() change_configs() create_www_user() fs.remove("temp")