Bug 1723237: Use pip-compile directly from vendored location r=ahal

We've been installing `piptools` so that we can use the `pip-compile`
binary. However, we can just as easily do
`python -m piptools compile ...` instead, which also allows us to
skip a redundant install.

Differential Revision: https://phabricator.services.mozilla.com/D123240
This commit is contained in:
Mitchell Hentges 2021-09-03 17:06:05 +00:00
Родитель 1c22a97031
Коммит 78827b7e2c
3 изменённых файлов: 8 добавлений и 10 удалений

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

@ -86,6 +86,7 @@ pth:third_party/python/more_itertools
pth:third_party/python/mozilla_version
pth:third_party/python/pathspec
pth:third_party/python/pep487/lib
pth:third_party/python/pip_tools
pth:third_party/python/pluggy
pth:third_party/python/ply
pth:third_party/python/py

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

@ -28,8 +28,9 @@ def test_up_to_date_vendor():
# Since VendorPython thinks "work_dir" is the topsrcdir,
# it will use its associated virtualenv and package configuration.
# Since it uses "pip-tools" within, and "pip-tools" needs
# the "Click" library, we need to make it available.
file.write("pth:third_party/python/Click")
# the "Click" library, we need to make them available.
file.write("pth:third_party/python/Click\n")
file.write("pth:third_party/python/pip_tools\n")
# Copy existing "third_party/python/" vendored files
existing_vendored = os.path.join(topsrcdir, "third_party", "python")

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

@ -21,14 +21,7 @@ class VendorPython(MozbuildObject):
self.log_manager.enable_unstructured()
vendor_dir = mozpath.join(self.topsrcdir, os.path.join("third_party", "python"))
self.activate_virtualenv()
pip_compile = os.path.join(self.virtualenv_manager.bin_path, "pip-compile")
if not os.path.exists(pip_compile):
path = os.path.normpath(
os.path.join(self.topsrcdir, "third_party", "python", "pip_tools")
)
self.virtualenv_manager.install_pip_package(path, vendored=True)
spec = os.path.join(vendor_dir, "requirements.in")
requirements = os.path.join(vendor_dir, "requirements.txt")
@ -41,7 +34,10 @@ class VendorPython(MozbuildObject):
# resolve the dependencies and update requirements.txt
subprocess.check_output(
[
pip_compile,
self.virtualenv_manager.python_path,
"-m",
"piptools",
"compile",
tmpspec,
"--no-header",
"--no-index",