Bug 1579455 - [mozbuild] Fix some Python 3 incompatibilities in virtualenv.py r=nalexander

Differential Revision: https://phabricator.services.mozilla.com/D45072

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Andrew Halberstadt 2019-09-09 20:38:41 +00:00
Родитель ce9b3465ec
Коммит e1a687b64f
1 изменённых файлов: 4 добавлений и 3 удалений

Просмотреть файл

@ -116,7 +116,8 @@ class VirtualenvManager(object):
on OS X our python path may end up being a different or modified
executable.
"""
ver = subprocess.check_output([python, '-c', 'import sys; print(sys.hexversion)']).rstrip()
ver = subprocess.check_output([python, '-c', 'import sys; print(sys.hexversion)'],
universal_newlines=True).rstrip()
with open(self.exe_info_path, 'w') as fh:
fh.write("%s\n" % ver)
fh.write("%s\n" % os.path.getsize(python))
@ -496,8 +497,8 @@ class VirtualenvManager(object):
and call .ensure() and .activate() to make the virtualenv active.
"""
execfile(self.activate_path, dict(__file__=self.activate_path))
if isinstance(os.environ['PATH'], unicode):
exec(open(self.activate_path).read(), dict(__file__=self.activate_path))
if sys.version_info[0] < 3 and isinstance(os.environ['PATH'], unicode):
os.environ['PATH'] = os.environ['PATH'].encode('utf-8')
def install_pip_package(self, package, vendored=False):