import os import hashlib import zipfile import tarfile def uncompress_file_to_dir(compressed_file, uncompress_dir): command = None extension = os.path.splitext(compressed_file)[1] try: os.mkdir(uncompress_dir) except FileExistsError as e: pass if extension == '.gz': tar = tarfile.open(compressed_file) tar.extractall(uncompress_dir) tar.close() elif extension == '.zip': zip_file = zipfile.ZipFile(compressed_file) zip_file.extractall(uncompress_dir) zip_file.close() uncompress_dir = os.path.join(uncompress_dir, os.listdir(uncompress_dir)[0]) if " " in os.listdir(uncompress_dir)[0]: print("replacing whitespace in directory name") os.rename(os.path.join(uncompress_dir, os.listdir(uncompress_dir)[0]), os.path.join(uncompress_dir, os.listdir(uncompress_dir)[0].replace(" ", "_"))) else: print("Error: unknown extension " + extension) return os.path.join(uncompress_dir, os.listdir(uncompress_dir)[0]) BUF_SIZE = 1048576 def get_hash(file_path): sha512 = hashlib.sha512() with open(file_path, 'rb') as f: while True: data = f.read(BUF_SIZE) if not data: break sha512.update(data) return sha512.hexdigest() def get_file_info(mar_file, url): filesize = os.path.getsize(mar_file) data = { 'hash' : get_hash(mar_file), 'hashFunction' : 'sha512', 'size' : filesize, 'url' : url + os.path.basename(mar_file)} return data def replace_variables_in_string(string, **kwargs): new_string = string for key, val in kwargs.items(): new_string = new_string.replace('$(%s)'%key, val) return new_string def make_complete_mar_name(target_dir, filename_prefix): filename = filename_prefix + "_complete.mar" return os.path.join(target_dir, filename) istro/cib/libreoffice-6-4'>distro/cib/libreoffice-6-4 LibreOffice 核心代码仓库文档基金会
summaryrefslogtreecommitdiff
path: root/dtrans
AgeCommit message (Expand)Author
2011-10-05simplfy dmake to gbuild bridgefileBjoern Michaelsen
2011-09-27Removed uses of rtl::O[U]String[Buffer]::operator sal_{char|Unicode} const *().Stephan Bergmann
2011-09-22Always link with user32Tor Lillqvist
2011-09-16Revert "Trying to chop out the uwinapi library"Fridrich Štrba
2011-09-16Trying to chop out the uwinapi libraryFridrich Štrba
2011-08-19detect gmake 3.81 and limit to -j1 unless num-cpu is explicitly setNorbert Thiebaud
2011-08-17add more component prefixesMatúš Kukan
2011-08-17cppcheck: remove assigned but unused variableTakeshi Abe
2011-08-12add XNotifyingDataObject also for gcc compilerMatúš Kukan
2011-08-11get this linking under windowsCaolán McNamara
2011-08-11get dtrans compiling under windows againCaolán McNamara
2011-08-10prefer makefile-gmake-mode to plain makefile-modeTakeshi Abe
2011-08-08convert dtrans to gbuilbMatúš Kukan
2011-07-12Remove component_getImplementationEnvironment methodsMatus Kukan
2011-06-23Use the newly introduced sehandler.hxx (now in solenv/wntgcci/inc)Tor Lillqvist
2011-06-23Fix includes for MinGW cross-compilationTor Lillqvist
2011-06-22Fix MinGW compilationTor Lillqvist