From 4346a9a9ef4c4defcdf18c1a41515ec627f02a1d Mon Sep 17 00:00:00 2001 From: mbusb Date: Sat, 6 May 2017 09:36:56 +0530 Subject: [PATCH] Reduce the usage of 7zip for extracting files --- scripts/_7zip.py | 6 +++--- scripts/iso.py | 5 ++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/scripts/_7zip.py b/scripts/_7zip.py index f1e70a8..990a971 100644 --- a/scripts/_7zip.py +++ b/scripts/_7zip.py @@ -29,12 +29,12 @@ def extract_iso(src, dst, pattern=None, suppress_out=True): # 7z x -y -oC:\path_to_directory X:\path_to_iso_file.iso # 7z e archive.zip -oC:\path_to_directory *.cfg *.bin -r if platform.system() == 'Windows': - cli_option = ' -bb1' # Linux does not accept this option (may be due to version diff). + cli_option = ' -ssc- -bb1' # Linux does not accept this option (may be due to version diff). if suppress_out != '': # suppress_out = ' 2> nul' suppress_out = '' else: - cli_option = '' + cli_option = ' -ssc- ' if suppress_out != '': suppress_out = ' 2> /dev/null' @@ -47,7 +47,7 @@ def extract_iso(src, dst, pattern=None, suppress_out=True): if pattern is None: _cmd = _7zip + cli_option + ' x -y -o' + gen.quote(dst) + ' ' + gen.quote(src) + suppress_out else: - _cmd = _7zip + ' x -y ' + gen.quote(src) + ' -o' + dst + ' ' + gen.quote(pattern) + ' -r' + suppress_out + _cmd = _7zip + cli_option + ' x -y ' + gen.quote(src) + ' -o' + dst + ' ' + gen.quote(pattern) + ' -r' + suppress_out gen.log('Executing ==> ' + _cmd) config.status_text = 'Status: Extracting ' + os.path.basename(src).strip() diff --git a/scripts/iso.py b/scripts/iso.py index 31d9ede..6c46fbf 100644 --- a/scripts/iso.py +++ b/scripts/iso.py @@ -168,12 +168,11 @@ def extract_cfg_file(iso_link): :param iso_link: Path to ISO file :return: """ - _pattern = ['.cfg', '.CFG', '.txt', '.TXT', 'isolinux.bin', 'ISOLINUX.BIN', '.lst'] + #_pattern = ['.cfg', '.CFG', '.txt', '.TXT', 'isolinux.bin', 'ISOLINUX.BIN', '.lst'] + _pattern = ['.cfg', '.txt', 'isolinux.bin', '.lst'] # file_list = iso_file_list(iso_link) for ext in _pattern: _7zip.extract_iso(iso_link, _iso_cfg_ext_dir, pattern='*' + ext) - #_7zip.extract_iso(iso_link, _iso_cfg_ext_dir, pattern='isolinux.bin ISOLINUX.BIN') - #_7zip.extract_iso(iso_link, _iso_cfg_ext_dir, pattern='*.cfg *.CFG *.txt *.TXT *.lst') def iso_extract_full(iso_link, dest_dir):