Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure that scripts have execute permissions #6

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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