Merge "Make our virtualenv source py3 safe"

This commit is contained in:
Jenkins 2017-03-14 01:35:36 +00:00 committed by Gerrit Code Review
commit a2f910d702

View File

@ -14,6 +14,7 @@
import os import os
import os.path import os.path
import runpy
import sys import sys
import diskimage_builder.paths import diskimage_builder.paths
@ -32,7 +33,9 @@ def running_under_virtualenv():
def activate_venv(): def activate_venv():
if running_under_virtualenv(): if running_under_virtualenv():
activate_this = os.path.join(sys.prefix, "bin", "activate_this.py") activate_this = os.path.join(sys.prefix, "bin", "activate_this.py")
execfile(activate_this, dict(__file__=activate_this)) globs = runpy.run_path(activate_this, globals())
globals().update(globs)
del globs
def main(): def main():