use PYTHON in utils/python-tools-setup.py if it is defined

Acked-By: Jamie Strandboge <jamie@canonical.com>
Acked-by: John Johansen <john.johansen@canonical.com>
This commit is contained in:
Jamie Strandboge 2012-07-01 09:12:29 -05:00
parent 3d4a98bed9
commit e7da3d81d1

View file

@ -40,7 +40,15 @@ class Install(_install, object):
scripts = ['/usr/bin/aa-easyprof']
self.mkpath(prefix + os.path.dirname(scripts[0]))
for s in scripts:
self.copy_file(os.path.basename(s), prefix + s)
f = prefix + s
# If we have a defined python version, use it instead of the system
# default
if 'PYTHON' in os.environ:
lines = open(os.path.basename(s)).readlines()
lines[0] = '#! /usr/bin/env %s\n' % os.environ['PYTHON']
open(f, 'w').write("".join(lines))
else:
self.copy_file(os.path.basename(s), f)
configs = ['easyprof/easyprof.conf']
self.mkpath(prefix + "/etc/apparmor")