in dh_virtualenv/deployment.py [0:0]
def fix_shebangs(self):
"""Translate '/usr/bin/python', '/usr/bin/env python', and 'python' shebang
lines to point to our virtualenv python.
"""
pythonpath = os.path.join(self.virtualenv_install_dir, 'bin/python')
for f in self.find_script_files():
regex = (r's-^#!\({names}\|.*bin/\(env \)\?{names}\"\?\)-#!{pythonpath}-;'
r"s-^'''exec'.*bin/{names}-'''exec' {pythonpath}-"
).format(names=_PYTHON_INTERPRETERS_REGEX, pythonpath=re.escape(pythonpath))
p = subprocess.Popen(
['sed', '-i', regex, f],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
)
subprocess.check_call(['sed', '-i', regex, f])