MCPcopy
hub / github.com/saltstack/salt / _install_requirements

Function _install_requirements

noxfile.py:277–330  ·  view source on GitHub ↗
(
    session,
    *extra_requirements,
    requirements_type="ci",
    onedir=False,
)

Source from the content-addressed store, hash-verified

275
276
277def _install_requirements(
278 session,
279 *extra_requirements,
280 requirements_type="ci",
281 onedir=False,
282):
283 if onedir and IS_LINUX:
284 session_run_always(
285 session, "python3", "-m", "pip", "install", "relenv[toolchain]"
286 )
287
288 if not _upgrade_pip_setuptools_and_wheel(session):
289 return False
290
291 # Install requirements
292 env = os.environ.copy()
293 env["PIP_CONSTRAINT"] = str(REPO_ROOT / "requirements" / "constraints.txt")
294
295 if onedir and IS_LINUX:
296 # bcrypt's PyPI wheels are tagged manylinux_2_28+ on the cpXY-abi3
297 # variants pip prefers on a modern build host, but the resulting
298 # ``_bcrypt.abi3.so`` then fails to load on older-glibc test hosts
299 # (e.g. Amazon Linux 2 with GLIBC 2.26). Source-compile bcrypt
300 # against the relenv toolchain so the resulting binary is portable
301 # across every Linux test slug. ``RELENV_BUILDENV=1`` makes the
302 # source build use ppbt's portable GCC + low-GLIBC sysroot (no
303 # effect on packages still installed as wheels).
304 env["PIP_NO_BINARY"] = "bcrypt"
305 env["RELENV_BUILDENV"] = "1"
306
307 requirements_file = _get_pip_requirements_file(
308 session, requirements_type=requirements_type
309 )
310 install_command = ["--progress-bar=off", "-r", requirements_file]
311 session.install(*install_command, silent=PIP_INSTALL_SILENT, env=env)
312
313 if extra_requirements:
314 install_command = ["--progress-bar=off"]
315 install_command += list(extra_requirements)
316 session.install(*install_command, silent=PIP_INSTALL_SILENT, env=env)
317
318 if EXTRA_REQUIREMENTS_INSTALL:
319 session.log(
320 "Installing the following extra requirements because the"
321 " EXTRA_REQUIREMENTS_INSTALL environment variable was set: %s",
322 EXTRA_REQUIREMENTS_INSTALL,
323 )
324 # We pass --constraint in this step because in case any of these extra dependencies has a requirement
325 # we're already using, we want to maintain the locked version
326 install_command = ["--progress-bar=off", "--constraint", requirements_file]
327 install_command += EXTRA_REQUIREMENTS_INSTALL.split()
328 session.install(*install_command, silent=PIP_INSTALL_SILENT, env=env)
329
330 return True
331
332
333def _install_coverage_requirement(session):

Callers 4

test_parametrizedFunction · 0.85
test_tornadoFunction · 0.85
_ci_testFunction · 0.85
ci_test_onedir_pkgsFunction · 0.85

Calls 6

session_run_alwaysFunction · 0.85
listFunction · 0.50
copyMethod · 0.45
installMethod · 0.45

Tested by 2

test_parametrizedFunction · 0.68
test_tornadoFunction · 0.68