Skip to content

Commit

Permalink
Ensure that scripts have execute permissions
Browse files Browse the repository at this point in the history
  • Loading branch information
jmroot committed Mar 30, 2021
1 parent cd121ab commit 7684f60
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions install/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,17 @@ def _replace_shebang(dir, interpreter): # type: (str, str) -> None
f.close()


def _make_executable(dir): # type: (str) -> None
scripts = [os.path.join(dir, script) for script in os.listdir(dir)]
import stat

for script in scripts:
mode = os.stat(script).st_mode
mode |= stat.S_IRUSR | stat.S_IXUSR | stat.S_IRGRP | stat.S_IXGRP \
| stat.S_IROTH | stat.S_IXOTH
os.chmod(script, mode)


def _check_requirement(requirement_string): # type: (str) -> bool
import packaging.requirements

Expand Down Expand Up @@ -238,9 +249,11 @@ def build(wheel, cache_dir, optimize=[0, 1, 2], verify_dependencies=False): # t

if os.path.isfile(entrypoints_file):
_generate_entrypoint_scripts(entrypoints_file, scripts_cache_dir)
_make_executable(scripts_cache_dir)

if os.path.isdir(scripts_dir):
_replace_shebang(scripts_dir, sys.executable)
_make_executable(scripts_dir)

_save_pickle(cache_dir, 'wheel-info', wheel_info)
_save_pickle(cache_dir, 'metadata', metadata)
Expand Down

0 comments on commit 7684f60

Please sign in to comment.