8000 Update pyvenv.cnf when decompressing nox · saltstack/salt@48acd41 · GitHub
[go: up one dir, main page]

Skip to content

Commit 48acd41

Browse files
committed
Update pyvenv.cnf when decompressing nox
1 parent a84b9b4 commit 48acd41

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

noxfile.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1273,6 +1273,27 @@ def decompress_dependencies(session):
12731273

12741274
session.log("Finding broken 'python' symlinks under '.nox/' ...")
12751275
for dirname in os.scandir(REPO_ROOT / ".nox"):
1276+
pyenv = REPO_ROOT.joinpath(".nox", dirname, "pyvenv.cfg")
1277+
pyenv_vars = []
1278+
if os.path.exists(pyenv):
1279+
# Update pyvenv.cnf configuration in case the location of
1280+
# everything changed.
1281+
with open(pyenv, encoding="utf-8") as fp:
1282+
for line in fp.readlines():
1283+
k, v = (_.strip() for _ in line.split("=", 1))
1284+
if k in [
1285+
"home",
1286+
"base-prefix",
1287+
"base-exec-prefix",
1288+
"base-executable",
1289+
]:
1290+
root, _path = v.split("artifacts/", 1)
1291+
v = str(REPO_ROOT / "artifacts" / _path)
1292+
pyenv_vars.append((k, v))
1293+
with open(pyenv, "w", encoding="utf-8") as fp:
1294+
for k, v in pyenv_vars:
1295+
fp.write(f"{k} = {v}\n")
1296+
12761297
scan_path = REPO_ROOT.joinpath(".nox", dirname, scripts_dir_name)
12771298
script_paths = {str(p): p for p in os.scandir(scan_path)}
12781299
fixed_shebang = f"#!{scan_path / 'python'}"

0 commit comments

Comments
 (0)
0