gecko-dev/third_party/python/pip_tools/piptools/subprocess_utils.py
ahochheiden bc34a9d56d Bug 1857470 - Vendor pip-tools at version 7.4.1 r=mach-reviewers,ahal
While nothing explicitly prompted updating this, letting `pip` and
`pip-tools` diverage too greatly in version release dates seems like
a bad idea, especially with the various deprecations in
`pip` and `python3.12`.

This also vendors the implicit dependencies `build`, `tomli`, and
`pyproject_hooks`.

Differential Revision: https://phabricator.services.mozilla.com/D210526
2024-05-27 23:06:19 +00:00

19 lines
578 B
Python

# WARNING! BE CAREFUL UPDATING THIS FILE
# Consider possible security implications associated with subprocess module.
from __future__ import annotations
import subprocess # nosec
def run_python_snippet(python_executable: str, code_to_run: str) -> str:
"""
Executes python code by calling python_executable with '-c' option.
"""
py_exec_cmd = python_executable, "-c", code_to_run
# subprocess module should never be used with untrusted input
return subprocess.check_output( # nosec
py_exec_cmd,
shell=False,
text=True,
)