3 export LC_CTYPE=iso-8859-1
4 exec "$(dirname "$0")/../config/bin/python" "$0" "$@"
7 from __future__ import absolute_import, print_function
8 from tempfile import NamedTemporaryFile
11 if sys.version_info[0] >= 3:
12 from shlex import quote
14 from pipes import quote
16 src_path, dest_path = sys.argv[1:]
18 with open(b'config/config.var/bup-python', 'rb') as src:
21 with NamedTemporaryFile() as tmp:
22 # Replace the section between "Here to end..." and the end of the
23 # preamble with the correct 'exec PYTHON "$0"'.
24 with open(src_path, 'rb') as src:
26 if line.startswith(b'# Here to end of preamble replaced during install'):
32 tmp.write(b'exec %s "$0"\n' % python)
37 shutil.copy(tmp.name, dest_path)
38 os.chmod(dest_path, 0o755)