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

Function decompress_dependencies

noxfile.py:1285–1419  ·  view source on GitHub ↗
(session)

Source from the content-addressed store, hash-verified

1283
1284@nox.session(python=False, name="decompress-dependencies")
1285def decompress_dependencies(session):
1286 if not session.posargs:
1287 session.error(
1288 "The 'decompress-dependencies' session target needs "
1289 "two arguments, '<platform> <arch>'."
1290 )
1291 try:
1292 platform = session.posargs.pop(0)
1293 arch = session.posargs.pop(0)
1294 if session.posargs:
1295 session.error(
1296 "The 'decompress-dependencies' session target only accepts "
1297 "two arguments, '<platform> <arch>'."
1298 )
1299 except IndexError:
1300 session.error(
1301 "The 'decompress-dependencies' session target needs "
1302 "two arguments, '<platform> <arch>'."
1303 )
1304 if platform == "windows":
1305 extension = "tar.gz"
1306 scripts_dir_name = "Scripts"
1307 pyexecutable = "python.exe"
1308 else:
1309 extension = "tar.xz"
1310 scripts_dir_name = "bin"
1311 pyexecutable = "python"
1312 nox_dependencies_tarball = f"nox.{platform}.{arch}.{extension}"
1313 nox_dependencies_tarball_path = REPO_ROOT / nox_dependencies_tarball
1314 if not nox_dependencies_tarball_path.exists():
1315 session.error(
1316 f"The {nox_dependencies_tarball} file "
1317 "does not exist. Not decompressing anything."
1318 )
1319
1320 session_run_always(session, "tar", "xpf", nox_dependencies_tarball)
1321 if os.environ.get("DELETE_NOX_ARCHIVE", "0") == "1":
1322 nox_dependencies_tarball_path.unlink()
1323
1324 session.log("Finding broken 'python' symlinks and configs under '.nox/' ...")
1325 # ``compress-dependencies`` archives the whole ``.nox`` tree. That tree is not
1326 # only per-session virtualenv folders (``ci-test-onedir``, etc.): it can also
1327 # contain plain files written by tooling, for example:
1328 #
1329 # - ``.nox/.gitignore`` — tells Git to ignore generated venv files
1330 # - ``.nox/CACHEDIR.TAG`` — cache-dir marker used by virtualenv and similar tools
1331 #
1332 # Those files are siblings of the venv directories. The code below must only
1333 # treat *directories* as virtualenvs. Otherwise we build paths like
1334 # ``.nox/.gitignore/Scripts`` and ``os.scandir`` raises FileNotFoundError.
1335 for entry in os.scandir(REPO_ROOT / ".nox"):
1336 if not entry.is_dir():
1337 continue
1338
1339 venv_dir = pathlib.Path(entry.path)
1340 scan_path = venv_dir / scripts_dir_name
1341 if not scan_path.is_dir():
1342 # Unexpected layout; skip rather than failing the whole session.

Callers

nothing calls this directly

Calls 12

read_textMethod · 0.95
session_run_alwaysFunction · 0.85
unlinkMethod · 0.80
is_dirMethod · 0.80
openFunction · 0.50
errorMethod · 0.45
popMethod · 0.45
existsMethod · 0.45
getMethod · 0.45
joinpathMethod · 0.45
writeMethod · 0.45
is_fileMethod · 0.45

Tested by

no test coverage detected