def build(module_params): check_dependencies(False, ['version'], module_params) version = module_params['version'] # fs.remove(origin_dir) # net.download_file(boost_url.format(version, str(version).replace('.', '_')), boost_archive) # archives.extract_7_zip(boost_archive, os.getcwd()) # fs.rename(os.path.join('boost_*'), origin_dir, True) set_system_variable('BOOST_ROOT', origin_dir) set_system_variable('BOOST_HOME', origin_dir) bootstrap_exec = 'bootstrap' b2_exec = 'b2' logs_dir = os.path.join(os.getcwd(), s_config.log_folder) require_full_path(logs_dir) with open(os.path.join(logs_dir, 'build_boost.log'), 'a+') as log_file: TemporaryDir.enter(origin_dir) subprocess.call([bootstrap_exec], stdout=log_file, stderr=log_file, shell=True) # x86 subprocess.call([b2_exec, '--libdir={}'.format(lib_directory), '--includedir={}'.format(headers_dir), '--address-model=32', '--stagedir={}'.format(lib_directory_x86), '--build-type=complete', '--link=static'], stdout=log_file, stderr=log_file, shell=True) subprocess.call([b2_exec, '--libdir={}'.format(lib_directory), '--includedir={}'.format(headers_dir), '--address-model=64', '--stagedir={}'.format(lib_directory_x64), '--build-type=complete', '--link=static'], stdout=log_file, stderr=log_file, shell=True) TemporaryDir.leave()
def make(directory, params=False, dependencies=False): print("Building project in " + directory) if not bool(params): params = {} if not bool(dependencies): dependencies = {} if bool(dependencies): install_distro_dependencies(dependencies) params_str = " ".join(["{0}={1}".format(key, val) for key, val in params.items()]) make_loc = which('make') if make_loc is None: raise Exception("'MAKE' IS NOT INSTALLED ON SYSTEM") sys.exit(1) login_file_name = os.path.join(sys_config.log_folder, 'make.txt') fs.require_full_path(login_file_name) with open(login_file_name, 'a+') as log_file: TemporaryDir.enter(os.path.abspath(directory)) process = subprocess.Popen(['make ', params_str], stderr=log_file, stdout=log_file, shell=True) process.communicate() if process.returncode != 0: raise Exception("'MAKE' finished with status-code " + str(process.returncode)) sys.exit(1) TemporaryDir.leave()
def build(module_params): check_dependencies(False, ['version'], module_params) version = module_params['version'] fs.remove(build_directory) net.download_file( boost_url.format(version, str(version).replace('.', '_')), boost_archive) archives.extract_7_zip(boost_archive, origin_dir) fs.rename(os.path.join(origin_dir, 'boost_*'), build_directory, False) set_system_variable('BOOST_ROOT', build_directory) set_system_variable('BOOST_HOME', build_directory) TemporaryDir.enter(build_directory) bootstrap_exec = 'bootstrap' b2_exec = 'b2' logs_dir = os.path.join(os.getcwd(), s_config.log_folder) require_full_path(logs_dir) with open(os.path.join(logs_dir, 'build_boost.log'), 'a+') as log_file: subprocess.call([bootstrap_exec], stdout=log_file, stderr=log_file, shell=True) subprocess.call([b2_exec], stdout=log_file, stderr=log_file, shell=True) TemporaryDir.leave() fs.remove(boost_archive) fs.clear( build_directory, cleanup_extensions['obj_files'], )
def make_v8(architecture, logs_dir): with open(os.path.join(logs_dir, 'gen_solution.log'), 'a+') as log_file: if is_windows(): v8_python_path = os.path.abspath(os.path.join(origin_dir, 'python276_bin{}python.exe'.format(os.path.sep))) print(v8_python_path) TemporaryDir.enter(v8_dir) subprocess.call([v8_python_path, 'build{}gyp_v8'.format(os.path.sep), '-Dtarget_arch=' + architecture, '-Dcomponent=static_library'], stderr=log_file, stdout=log_file, shell=True) # TODO: modify MT MTd flags if necessary vcxproj_to_change = ('third_party/icu/icui18n.vcxproj', 'third_party/icu/icuuc.vcxproj', 'tools/gyp/mksnapshot.vcxproj', 'tools/gyp/v8_base_0.vcxproj', 'tools/gyp/v8_base_1.vcxproj', 'tools/gyp/v8_base_2.vcxproj', 'tools/gyp/v8_base_0.vcxproj', 'tools/gyp/v8_libbase.vcxproj', 'tools/gyp/v8_libplatform.vcxproj', 'tools/gyp/v8_nosnapshot.vcxproj', 'tools/gyp/v8_snapshot.vcxproj' ) # for vcxproj_file in vcxproj_to_change: # vcxproj_file = os.path.join(v8_dir, vcxproj_file) # assembly.set_vcxproj_platform_toolset(vcxproj_file, config.visual_studio_toolset) # assembly.set_vcxproj_runtime_library(vcxproj_file, config.visual_studio_runtime_library) # assembly.build_vcxproj(os.path.join(v8_dir, 'tools', 'gyp', 'v8.vcxproj')) TemporaryDir.leave() assembly.build_vcxproj(os.path.join(v8_dir, 'tools', 'gyp', 'v8.vcxproj'), lib_directory)
def make(directory, params=False, dependencies=False): print("Building project in " + directory) if not bool(params): params = {} if not bool(dependencies): dependencies = {} if bool(dependencies): install_distro_dependencies(dependencies) params_str = " ".join( ["{0}={1}".format(key, val) for key, val in params.items()]) make_loc = which('make') if make_loc is None: raise Exception("'MAKE' IS NOT INSTALLED ON SYSTEM") sys.exit(1) login_file_name = os.path.join(sys_config.log_folder, 'make.txt') fs.require_full_path(login_file_name) with open(login_file_name, 'a+') as log_file: TemporaryDir.enter(os.path.abspath(directory)) process = subprocess.Popen(['make ', params_str], stderr=log_file, stdout=log_file, shell=True) process.communicate() if process.returncode != 0: raise Exception("'MAKE' finished with status-code " + str(process.returncode)) sys.exit(1) TemporaryDir.leave()
def write_results(self): TemporaryDir.enter(self.full_module_location) fnc = self.function_in_tasks_exist( s_config.module_integration_function) if bool(fnc): fnc(self.module_configs) TemporaryDir.leave()
def write_results(self): LibraryModule.results = structs.default_dependency_struct.copy() TemporaryDir.enter(self.full_module_location) fnc = self.function_in_tasks_exist(s_config.module_integration_function) if bool(fnc): fnc(self.module_configs) TemporaryDir.leave() return LibraryModule.results
def make_install(directory): TemporaryDir.enter(directory) process = subprocess.Popen(['gksudo make install'], shell=True) process.communicate() if process.returncode != 0: raise Exception("'MAKE INSTALL' finished with status-code " + process.returncode) sys.exit(1) TemporaryDir.leave()
def fetch_v8(version, logs_dir): vcs.git_clone('https://chromium.googlesource.com/chromium/tools/depot_tools.git', origin_dir, True) TemporaryDir.enter(origin_dir) with open(os.path.join(logs_dir, 'fetch_v8.log'), 'a+') as log_file: print('Fetching v8') subprocess.call(['fetch', 'v8'], stderr=log_file, stdout=log_file, shell=True) print('Synchronizing') subprocess.call(['gclient', 'sync'], stderr=log_file, stdout=log_file, shell=True) TemporaryDir.leave() vcs.git_checkout(v8_dir, version)
def configure(directory, params): params_str = " ".join(["{0}={1}".format(key, val) for key, val in params.items()]) TemporaryDir.enter(directory) if os.path.isfile('configure'): process = subprocess.Popen(['./configure ' + params_str], shell=True) process.communicate() if process.returncode != 0: raise Exception("'Configure' finished with status-code " + process.returncode) sys.exit(1) TemporaryDir.leave()
def make_install(directory): print("Installing project in " + directory) log_file = os.path.join(sys_config.log_folder, 'make_install.log') with open(log_file, 'a+') as log_file: TemporaryDir.enter(directory) process = sudo(['make', 'install'], stdout=log_file, stderr=log_file) if process.returncode != 0: raise Exception("'MAKE INSTALL' finished with status-code " + str(process.returncode)) sys.exit(1) TemporaryDir.leave()
def prepare(self): TemporaryDir.enter(self.full_module_location) print("###### Processing module '{0}' ####".format(self.module_name)) LibraryModule.current_working_module = self.module_name if self.module_need_rebuild(): fnc = self.function_in_tasks_exist(s_config.module_prepare_function) if bool(fnc): fnc(self.module_configs) print("###### Library successfully processed #### ") LibraryModule.__set_cache('built', True) else: print("###### Library has been processed... Skipping #### ") TemporaryDir.leave()
def prepare(self): TemporaryDir.enter(self.full_module_location) print("###### Processing module '{0}' ####".format(self.module_name)) LibraryModule.current_working_module = self.module_name if self.module_need_rebuild(): fnc = self.function_in_tasks_exist( s_config.module_prepare_function) if bool(fnc): fnc(self.module_configs) print("###### Library successfully processed #### ") LibraryModule.__set_cache('built', True) else: print("###### Library has been processed... Skipping #### ") TemporaryDir.leave()
def configure(directory, params={}, inline_params=[], log_file=False): print("Run configure script in " + directory) params_str = " ".join(["{0}={1}".format(key, val) for key, val in params.items()]) params_str += " " + " ".join(inline_params) if type(log_file) is not str: log_file = "configure.log" log_file_name = os.path.join(sys_config.log_folder, log_file) with open(log_file_name, 'a+') as log_file: TemporaryDir.enter(directory) process = subprocess.Popen(['./configure ' + params_str], shell=True, stderr=log_file, stdout=log_file) process.communicate() TemporaryDir.leave() if process.returncode != 0: raise Exception("'Configure' finished with status-code " + process.returncode) sys.exit(1)
def fetch_v8(version, logs_dir): vcs.git_clone( 'https://chromium.googlesource.com/chromium/tools/depot_tools.git', origin_dir, True) TemporaryDir.enter(origin_dir) with open(os.path.join(logs_dir, 'fetch_v8.log'), 'a+') as log_file: print('Fetching v8') subprocess.call(['fetch', 'v8'], stderr=log_file, stdout=log_file, shell=True) print('Synchronizing') subprocess.call(['gclient', 'sync'], stderr=log_file, stdout=log_file, shell=True) TemporaryDir.leave() vcs.git_checkout(v8_dir, version)
def configure(directory, params={}, inline_params=[], log_file=False): print("Run configure script in " + directory) params_str = " ".join( ["{0}={1}".format(key, val) for key, val in params.items()]) params_str += " " + " ".join(inline_params) if type(log_file) is not str: log_file = "configure.log" log_file_name = os.path.join(sys_config.log_folder, log_file) with open(log_file_name, 'a+') as log_file: TemporaryDir.enter(directory) process = subprocess.Popen(['./configure ' + params_str], shell=True, stderr=log_file, stdout=log_file) process.communicate() TemporaryDir.leave() if process.returncode != 0: raise Exception("'Configure' finished with status-code " + process.returncode) sys.exit(1)
def find_files_by_masks(self, masks, abs_paths=False): result = [] TemporaryDir.enter(self.project_dir) def make_abs_paths(paths): return [os.path.abspath(path) for path in paths] def find_files_by_mask(search_mask): files = glob.glob(search_mask) if abs_paths: files = make_abs_paths(files) return files if isinstance(masks, list): for mask in masks: result.extend(find_files_by_mask(mask)) elif isinstance(masks, str): result.extend(find_files_by_mask(masks)) TemporaryDir.leave() return result
def make_v8(architecture, logs_dir): with open(os.path.join(logs_dir, 'gen_solution.log'), 'a+') as log_file: if is_windows(): v8_python_path = os.path.abspath( os.path.join(origin_dir, 'python276_bin{}python.exe'.format(os.path.sep))) print(v8_python_path) TemporaryDir.enter(v8_dir) subprocess.call([ v8_python_path, 'build{}gyp_v8'.format(os.path.sep), '-Dtarget_arch=' + architecture, '-Dcomponent=static_library' ], stderr=log_file, stdout=log_file, shell=True) # TODO: modify MT MTd flags if necessary vcxproj_to_change = ('third_party/icu/icui18n.vcxproj', 'third_party/icu/icuuc.vcxproj', 'tools/gyp/mksnapshot.vcxproj', 'tools/gyp/v8_base_0.vcxproj', 'tools/gyp/v8_base_1.vcxproj', 'tools/gyp/v8_base_2.vcxproj', 'tools/gyp/v8_base_0.vcxproj', 'tools/gyp/v8_libbase.vcxproj', 'tools/gyp/v8_libplatform.vcxproj', 'tools/gyp/v8_nosnapshot.vcxproj', 'tools/gyp/v8_snapshot.vcxproj') # for vcxproj_file in vcxproj_to_change: # vcxproj_file = os.path.join(v8_dir, vcxproj_file) # assembly.set_vcxproj_platform_toolset(vcxproj_file, config.visual_studio_toolset) # assembly.set_vcxproj_runtime_library(vcxproj_file, config.visual_studio_runtime_library) # assembly.build_vcxproj(os.path.join(v8_dir, 'tools', 'gyp', 'v8.vcxproj')) TemporaryDir.leave() assembly.build_vcxproj( os.path.join(v8_dir, 'tools', 'gyp', 'v8.vcxproj'), lib_directory)
def build(module_params): check_dependencies(False, ['version'], module_params) version = module_params['version'] fs.remove(build_directory) net.download_file(boost_url.format(version, str(version).replace('.', '_')), boost_archive) archives.extract_7_zip(boost_archive, origin_dir) fs.rename(os.path.join(origin_dir, 'boost_*'), build_directory, False) set_system_variable('BOOST_ROOT', build_directory) set_system_variable('BOOST_HOME', build_directory) TemporaryDir.enter(build_directory) bootstrap_exec = 'bootstrap' b2_exec = 'b2' logs_dir = os.path.join(os.getcwd(), s_config.log_folder) require_full_path(logs_dir) with open(os.path.join(logs_dir, 'build_boost.log'), 'a+') as log_file: subprocess.call([bootstrap_exec], stdout=log_file, stderr=log_file, shell=True) subprocess.call([b2_exec], stdout=log_file, stderr=log_file, shell=True) TemporaryDir.leave() fs.remove(boost_archive) fs.clear(build_directory, cleanup_extensions['obj_files'],)
def remove_cache(self): TemporaryDir.enter(self._sourcesDir) if os.path.isfile('CMakeCache.txt'): os.remove('CMakeCache.txt') TemporaryDir.leave()