]> arthur.barton.de Git - bup.git/blob - cmd/python-cmd.sh
Fix the handling of the configure MAKE and PYTHON vars
[bup.git] / cmd / python-cmd.sh
1 #!/bin/sh
2
3 set -e
4
5 top="$(pwd)"
6 cmdpath="$0"
7 # loop because macos has no recursive resolution
8 while test -L "$cmdpath"; do
9     link="$(readlink "$cmdpath")"
10     cd "$(dirname "$cmdpath")"
11     cmdpath="$link"
12 done
13 script_home="$(cd "$(dirname "$cmdpath")" && pwd -P)"
14 cd "$top"
15
16 # Force python to use ISO-8859-1 (aka Latin 1), a single-byte
17 # encoding, to help avoid any manipulation of data from system APIs
18 # (paths, users, groups, command line arguments, etc.)
19
20 # Preserve for selective use
21 if [ "${LC_CTYPE+x}" ]; then export BUP_LC_CTYPE="$LC_CTYPE"; fi
22 if [ "${LC_ALL+x}" ]; then
23     export BUP_LC_ALL="$LC_ALL"
24     export LC_COLLATE="$LC_ALL"
25     export LC_MONETARY="$LC_ALL"
26     export LC_NUMERIC="$LC_ALL"
27     export LC_TIME="$LC_ALL"
28     export LC_MESSAGES="$LC_ALL"
29     unset LC_ALL
30 fi
31
32 export PYTHONCOERCECLOCALE=0  # Perhaps not necessary, but shouldn't hurt
33 export LC_CTYPE=ISO-8859-1
34
35 bup_libdir="$script_home/../lib"  # bup_libdir will be adjusted during install
36
37 export PYTHONPATH="$bup_libdir${PYTHONPATH:+:$PYTHONPATH}"
38
39 exec @bup_python@ "$@"