Put ${REPO_PATH}/.local/bin in PATH too
MODIFY
repo2docker/buildpacks/base.py
repo2docker/buildpacks/base.py
@@ -102,6 +102,16 @@ ARG REPO_DIR=${HOME}
ENV REPO_DIR ${REPO_DIR}
WORKDIR ${REPO_DIR}
+# We want to allow two things:
+# 1. If there's a .local/bin directory in the repo, things there
+# should automatically be in path
+# 2. postBuild and users should be able to install things into ~/.local/bin
+# and have them be automatically in path
+#
+# The XDG standard suggests ~/.local/bin as the path for local user-specific
+# installs. See https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
+ENV PATH ${HOME}/.local/bin:${REPO_DIR}/.local/bin:${PATH}
+
# Copy and chown stuff. This doubles the size of the repo, because
# you can't actually copy as USER, only as root! Thanks, Docker!
USER root
@@ -243,10 +253,7 @@ class BuildPack:
Just sets the PATH environment variable. Separated out since
it is very commonly set by various buildpacks.
"""
- # Allow local user installs into ~/.local, which is where the
- # XDG desktop standard suggests these should be
- # See https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
- return ['$HOME/.local/bin']
+ return []
def get_labels(self):
"""

MODIFY
tests/venv/usr-bin/verify
tests/venv/usr-bin/verify
#!/usr/bin/env python
-# Verify that ~/.local/bin is on the PATH
+# Verify that ~/.local/bin & REPO_DIR/.local/bin is on the PATH
import os
assert os.path.expanduser('~/.local/bin') in os.getenv("PATH"), os.getenv("PATH")
+assert os.getcwd() == os.environ['REPO_DIR']
+assert '{}/.local/bin'.format(os.environ['REPO_DIR']) in os.getenv('PATH')

Put ${REPO_PATH}/.local/bin in PATH too