Bug 1628498 - Hackaround: Try to build virtualenv from scratch if there was a previous one. r=rstewart

This works for me and should allow trees to reopen.

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

--HG--
extra : histedit_source : 529e1cb5cdb3030f145f44fc1ebf0ea9ae00aa8f
This commit is contained in:
Emilio Cobos Álvarez 2020-04-09 17:50:59 +00:00
Родитель 3d7b9a57dd
Коммит 587d6bcab6
1 изменённых файлов: 6 добавлений и 0 удалений

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

@ -222,6 +222,7 @@ class VirtualenvManager(object):
called out to), the path to create the virtualenv in, and a handle to called out to), the path to create the virtualenv in, and a handle to
write output to. write output to.
""" """
existed = os.path.exists(self.virtualenv_root)
args = [python, self.virtualenv_script_path, args = [python, self.virtualenv_script_path,
# Without this, virtualenv.py may attempt to contact the outside # Without this, virtualenv.py may attempt to contact the outside
@ -233,6 +234,11 @@ class VirtualenvManager(object):
result = self._log_process_output(args) result = self._log_process_output(args)
if result and existed:
# Try again after removing the previous env, see bug 1628644.
shutil.rmtree(self.virtualenv_root)
result = self._log_process_output(args)
if result: if result:
raise Exception( raise Exception(
'Failed to create virtualenv: %s (virtualenv.py retcode: %s)' % ( 'Failed to create virtualenv: %s (virtualenv.py retcode: %s)' % (