Skip to content

Commit

Permalink
Merge pull request #335 from jakirkham/fix_exec_perm
Browse files Browse the repository at this point in the history
Fix permissions
  • Loading branch information
jakirkham authored Oct 29, 2016
2 parents b7be5b6 + 6663329 commit 52f75de
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 8 deletions.
25 changes: 19 additions & 6 deletions conda_smithy/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,25 @@ def init_git_repo(target):

def create_git_repo(target, msg):
init_git_repo(target)
subprocess.check_call(['git', 'add', '*'], cwd=target)
if sys.platform == "win32":
# prevent this:
# bash: line 1: ./ci_support/run_docker_build.sh: Permission denied
# ./ci_support/run_docker_build.sh returned exit code 126
subprocess.check_call(['git', 'update-index', '--chmod=+x', 'ci_support/run_docker_build.sh'], cwd=target)
subprocess.check_call(['git', 'add', '-A'], cwd=target)

# Ensure shell scripts have executable permissions.
executable_files = [
"ci_support/checkout_merge_commit.sh",
"ci_support/run_docker_build.sh",
]
for each_executable_file in executable_files:
if os.path.exists(os.path.join(target, each_executable_file)):
subprocess.check_call(
[
'git',
'update-index',
'--chmod=+x',
each_executable_file
],
cwd=target
)

subprocess.check_call(['git', 'commit', '-m', msg], cwd=target)


Expand Down
15 changes: 13 additions & 2 deletions conda_smithy/configure_feedstock.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,19 @@ def render_run_docker_build(jinja_env, forge_config, forge_dir):
target_fname = os.path.join(forge_dir, 'ci_support', 'run_docker_build.sh')
with open(target_fname, 'w') as fh:
fh.write(template.render(**forge_config))
st = os.stat(target_fname)
os.chmod(target_fname, st.st_mode | stat.S_IEXEC)

# Fix permissions.
target_fnames = [
os.path.join(forge_dir, 'ci_support', 'run_docker_build.sh'),
os.path.join(forge_dir, 'ci_support', 'checkout_merge_commit.sh'),
]
for each_target_fname in target_fnames:
if os.path.exists(each_target_fname):
st = os.stat(each_target_fname)
os.chmod(
each_target_fname,
st.st_mode | stat.S_IXOTH | stat.S_IXGRP | stat.S_IXUSR
)


def render_circle(jinja_env, forge_config, forge_dir):
Expand Down

0 comments on commit 52f75de

Please sign in to comment.