@@ -91,7 +91,7 @@ if [ -v DEVCONTAINER_ENV ]; then
9191 NPM=" npm"
9292 NPX=" npx"
9393 NODE=" node"
94- PYTHON=" python3"
94+ PYTHON=" ${ROOT} /.home/.venv/bin/ python3"
9595 PIP=" ${ROOT} /.home/.venv/bin/pip"
9696 BASH=" bash"
9797else
@@ -101,7 +101,33 @@ else
101101 NPM=" singularity run ${HOME_OPT} ${CONTAINER_PATH} npm"
102102 NPX=" singularity run ${HOME_OPT} ${CONTAINER_PATH} npx"
103103 NODE=" singularity run ${HOME_OPT} ${CONTAINER_PATH} node"
104- PYTHON=" singularity run ${HOME_OPT} ${CONTAINER_PATH} python3"
104+ PYTHON=" singularity run ${HOME_OPT} ${CONTAINER_PATH} ${ROOT} /.home/.venv/bin/ python3"
105105 PIP=" singularity run ${HOME_OPT} ${CONTAINER_PATH} ${ROOT} /.home/.venv/bin/pip"
106106 BASH=" singularity run ${HOME_OPT} ${CONTAINER_PATH} bash"
107107fi
108+
109+ if [ ! -f $ROOT /.git/hooks/pre-commit ]; then
110+ cat << HOOK > $ROOT /.git/hooks/pre-commit
111+ #!/usr/bin/env bash
112+ # File generated by pre-commit: https://pre-commit.com
113+ # ID: 138fd403232d2ddd5efb44317e38bf03
114+
115+ # start templated
116+ INSTALL_PYTHON=$ROOT /bin/python
117+ ARGS=(hook-impl --config=.pre-commit-config.yaml --hook-type=pre-commit)
118+ # end templated
119+
120+ HERE="$( cd " $( dirname " \$ 0" ) " && pwd) "
121+ ARGS+=(--hook-dir "\$ HERE" -- "\$ @")
122+
123+ if [ -x "\$ INSTALL_PYTHON" ]; then
124+ exec "\$ INSTALL_PYTHON" -mpre_commit "\$ {ARGS[@]}"
125+ elif command -v pre-commit > /dev/null; then
126+ exec pre-commit "\$ {ARGS[@]}"
127+ else
128+ echo '` pre-commit` not found. Did you forget to activate your virtualenv?' 1>&2
129+ exit 1
130+ fi
131+ HOOK
132+ chmod +x $ROOT /.git/hooks/pre-commit
133+ fi
0 commit comments