diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 09:27:30 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 09:27:30 +0000 |
commit | a2baea7faff31d26459dab3668a39eae85e4991b (patch) | |
tree | eaa2048ce9c715481f932dcfe20368e252b77d2f /bin/update/tools.py | |
parent | Adding upstream version 4:24.2.0. (diff) | |
download | libreoffice-upstream/4%24.2.1.tar.xz libreoffice-upstream/4%24.2.1.zip |
Adding upstream version 4:24.2.1.upstream/4%24.2.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'bin/update/tools.py')
-rw-r--r-- | bin/update/tools.py | 30 |
1 files changed, 10 insertions, 20 deletions
diff --git a/bin/update/tools.py b/bin/update/tools.py index ab38d10f4b..6bc3f7971f 100644 --- a/bin/update/tools.py +++ b/bin/update/tools.py @@ -1,30 +1,20 @@ import os import hashlib -import zipfile -import tarfile +import subprocess +from path import convert_to_native -def uncompress_file_to_dir(compressed_file, uncompress_dir): - extension = os.path.splitext(compressed_file)[1] +def uncompress_file_to_dir(compressed_file, uncompress_dir): os.makedirs(uncompress_dir, exist_ok=True) - if extension == '.gz': - with tarfile.open(compressed_file) as tar: - tar.extractall(uncompress_dir) - elif extension == '.zip': - with zipfile.ZipFile(compressed_file) as zip_file: - zip_file.extractall(uncompress_dir) - - 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]) + if subprocess.call([ + 'msiexec', '/a', convert_to_native(compressed_file).replace('/', '\\'), + '/quiet', + 'TARGETDIR=' + convert_to_native(uncompress_dir).replace('/', '\\')]) != 0: + raise Exception(f'msiexec failed') + + return uncompress_dir BUF_SIZE = 1048576 |