diff --git a/emsdk b/emsdk index 9f3e348..ad2415b 100755 --- a/emsdk +++ b/emsdk @@ -503,6 +503,12 @@ def unzip(source_filename, dest_dir, unpack_even_if_exists=False): # Now do the actual decompress. for member in zf.infolist(): zf.extract(member, fix_potentially_long_windows_pathname(unzip_to_dir)) + dst_filename = os.path.join(unzip_to_dir, member.filename) + + # See: https://stackoverflow.com/questions/42326428/zipfile-in-python-file-permission + unix_attributes = member.external_attr >> 16 + if unix_attributes: + os.chmod(dst_filename, unix_attributes) # Move the extracted file to its final location without the base directory name, if we are stripping that away. if common_subdir: @@ -514,11 +520,10 @@ def unzip(source_filename, dest_dir, unpack_even_if_exists=False): d = fix_potentially_long_windows_pathname(final_dst_filename) if not os.path.isdir(d): os.mkdir(d) else: - tmp_dst_filename = os.path.join(unzip_to_dir, member.filename) parent_dir = os.path.dirname(fix_potentially_long_windows_pathname(final_dst_filename)) if parent_dir and not os.path.exists(parent_dir): os.makedirs(parent_dir) - move_with_overwrite(fix_potentially_long_windows_pathname(tmp_dst_filename), fix_potentially_long_windows_pathname(final_dst_filename)) + move_with_overwrite(fix_potentially_long_windows_pathname(dst_filename), fix_potentially_long_windows_pathname(final_dst_filename)) if common_subdir: try: diff --git a/test.py b/test.py old mode 100644 new mode 100755 index 2e50c7e..ef1a6eb --- a/test.py +++ b/test.py @@ -1,3 +1,4 @@ +#!/usr/bin/env python import json import os import shlex @@ -149,13 +150,13 @@ temp_dir = tempfile.mkdtemp() for filename in os.listdir('.'): if not filename.startswith('.') and not os.path.isdir(filename): - shutil.copyfile(filename, os.path.join(temp_dir, filename)) + shutil.copy2(filename, os.path.join(temp_dir, filename)) os.chdir(temp_dir) -check_call('python ./emsdk update') +check_call('./emsdk update') print('second time') -check_call('python ./emsdk update') +check_call('./emsdk update') print('verify downloads exist for all OSes') latest_hash = TAGS['releases'][TAGS['latest']] diff --git a/test.sh b/test.sh old mode 100644 new mode 100755 index a79b866..06bf9db --- a/test.sh +++ b/test.sh @@ -1,3 +1,4 @@ +#!/usr/bin/env sh echo "test the standard workflow (as close as possible to how a user would do it, in the shell)" ./emsdk install latest ./emsdk activate latest