[arch-general] simple trick to make dealing with python 2/3 scripts easier

Ben Booth bwbooth at lbl.gov
Thu Aug 23 16:24:11 EDT 2012


In case anyone's still interested in this, I found a pacman.conf option 
called NoExtract, which lets you tell pacman not to overwrite certain files 
and directories in the filesystem. So you could add the following line to 
/etc/pacman.conf:

NoExtract = /usr/bin/python

which would prevent pacman from overwriting the custom /usr/bin/python 
script. Here is the most recent version of the /usr/bin/python script:

#!/usr/bin/env bash
test "$PYTHON" != "python2" -a "$PYTHON" != "python3" && unset PYTHON
exec /usr/bin/"${PYTHON:-python3}" "$@"

This version does some input checking to make sure the only valid options 
for the PYTHON environment variable are "python2" or "python3".

Ben



More information about the arch-general mailing list