Make our virtualenv source py3 safe
execfile() has gone in python3, and if you google various stackoverflow results, python-dev mailing list threads and other projects it seems runpy is considered one of the better solutions. This should be py2.7 safe too. Change-Id: I18077ba9d603752492cc81f260e12710981f4dff
This commit is contained in:
parent
b04c58eca4
commit
85985cdadc
@ -14,6 +14,7 @@
|
||||
|
||||
import os
|
||||
import os.path
|
||||
import runpy
|
||||
import sys
|
||||
|
||||
import diskimage_builder.paths
|
||||
@ -32,7 +33,9 @@ def running_under_virtualenv():
|
||||
def activate_venv():
|
||||
if running_under_virtualenv():
|
||||
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():
|
||||
|
Loading…
Reference in New Issue
Block a user