зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1717051: Only use stdlib for installing pip packages r=ahal
`_install_pip_package()` may be run from `populate()`, which is invoked from a child Python process that doesn't have in-tree Python modules in its sys.path. An alternate solution would be to add in-tree modules to the sys.path, but that seemed more costly than simply using `tempfile` and `shutil`. Differential Revision: https://phabricator.services.mozilla.com/D119834
This commit is contained in:
Родитель
ff3f9b87f4
Коммит
16b857cec1
|
@ -14,6 +14,7 @@ import platform
|
||||||
import shutil
|
import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
|
from tempfile import TemporaryDirectory
|
||||||
|
|
||||||
IS_NATIVE_WIN = sys.platform == "win32" and os.sep == "\\"
|
IS_NATIVE_WIN = sys.platform == "win32" and os.sep == "\\"
|
||||||
IS_CYGWIN = sys.platform == "cygwin"
|
IS_CYGWIN = sys.platform == "cygwin"
|
||||||
|
@ -437,9 +438,6 @@ class VirtualenvManager(VirtualenvHelper):
|
||||||
If vendored is True, no package index will be used and no dependencies
|
If vendored is True, no package index will be used and no dependencies
|
||||||
will be installed.
|
will be installed.
|
||||||
"""
|
"""
|
||||||
import mozfile
|
|
||||||
from mozfile import TemporaryDirectory
|
|
||||||
|
|
||||||
if sys.executable.startswith(self.bin_path):
|
if sys.executable.startswith(self.bin_path):
|
||||||
# If we're already running in this interpreter, we can optimize in
|
# If we're already running in this interpreter, we can optimize in
|
||||||
# the case that the package requirement is already satisfied.
|
# the case that the package requirement is already satisfied.
|
||||||
|
@ -482,7 +480,7 @@ class VirtualenvManager(VirtualenvHelper):
|
||||||
tmp, "{}-1.0-py3-none-any.whl".format(os.path.basename(package))
|
tmp, "{}-1.0-py3-none-any.whl".format(os.path.basename(package))
|
||||||
)
|
)
|
||||||
shutil.make_archive(wheel_file, "zip", package)
|
shutil.make_archive(wheel_file, "zip", package)
|
||||||
mozfile.move("{}.zip".format(wheel_file), wheel_file)
|
shutil.move("{}.zip".format(wheel_file), wheel_file)
|
||||||
package = wheel_file
|
package = wheel_file
|
||||||
|
|
||||||
args.append(package)
|
args.append(package)
|
||||||
|
|
Загрузка…
Ссылка в новой задаче