Merge "Add dib-python element"

This commit is contained in:
Jenkins 2015-12-15 23:24:25 +00:00 committed by Gerrit Code Review
commit d716893e30
2 changed files with 26 additions and 0 deletions

View File

@ -0,0 +1,9 @@
===========
dib=-python
===========
Adds a symlink to /usr/local/bin/dib-python which points at either a python2
or python3 executable. This is useful for creating #! lines for scripts that
are compatible with both python2 and python3.
This does not install a python if one does not exist, and instead fails.

View File

@ -0,0 +1,17 @@
#!/bin/bash
if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then
set -x
fi
set -eu
set -o pipefail
which which || install-packages which
python_path=$(which python2 || which python3)
if [ -z "$python_path" ]; then
echo "Could not find python2 or python3 executable."
exit 1
fi
ln -s $python_path /usr/local/bin/dib-python