Do not require postBuild to be executable
This is hard for windows users and from the GitHub UI,
and provides dubious benefits. So let's remove the requirement!
Fixes
MODIFY
repo2docker/buildpacks/base.py
repo2docker/buildpacks/base.py
@@ -3,7 +3,6 @@ import jinja2
import tarfile
import io
import os
-import stat
import re
import logging
import docker
@@ -107,15 +106,14 @@ LABEL {{k}}={{v}}
# We always want containers to run as non-root
USER ${NB_USER}
+# Make sure that postBuild scripts are marked executable before executing them
{% if post_build_scripts -%}
{% for s in post_build_scripts -%}
-RUN ./{{ s }}
+RUN chmod +x {{ s }} && ./{{ s }}
{% endfor %}
{% endif -%}
"""
-DOC_URL = "http://repo2docker.readthedocs.io/en/latest/samples.html"
-
class BuildPack:
"""
@@ -409,9 +407,5 @@ class BaseImage(BuildPack):
def get_post_build_scripts(self):
post_build = self.binder_path('postBuild')
if os.path.exists(post_build):
- if not stat.S_IXUSR & os.stat(post_build).st_mode:
- raise ValueError("%s is not executable, see %s for help." % (
- post_build,
- DOC_URL+'#system-post-build-scripts'))
return [post_build]
return []

MODIFY
tests/venv/postBuild/README.rst
tests/venv/postBuild/README.rst
@@ -5,15 +5,3 @@ It is possible to run scripts after you've built the environment specified in
your other files. This could be used to, for example, download data or run
some configuration scripts. For example, this will download and install a
Jupyter extension.
\ No newline at end of file
-
-.. note::
-
- This file needs to be executable in order to work with ``repo2docker``. If
- you're on Linux or macOS, run::
-
- chmod +x postBuild
-
- If you're on windows, you can accomplish the same behavior with this
- ``git`` command::
-
- git update-index --chmod=+x postBuild

Do not require postBuild to be executable

This is hard for windows users and from the GitHub UI,
and provides dubious benefits. So let's remove the requirement!

Fixes #240