Skip to content

Commit 3af55a7

Browse files
committed
Drop walrus operators for Python 3.7 compatibility
1 parent 8229a4e commit 3af55a7

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

tox_pdm/plugin3.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ def tox_addoption(parser: config.Parser) -> Any:
2828

2929
@hookimpl
3030
def tox_configure(config: config.Config):
31-
if scripts := pdm_scripts(config.toxinidir):
31+
scripts = pdm_scripts(config.toxinidir)
32+
if scripts:
3233
for cfg in config.envconfigs.values():
3334
cfg.allowlist_externals.append("pdm")
3435
for lineno, cmd in enumerate(cfg.commands):

tox_pdm/plugin4.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@ def execute(
7272
run_id: str = "",
7373
executor: Execute | None = None,
7474
) -> Outcome:
75-
if scripts := pdm_scripts(self.core["tox_root"]):
75+
scripts = pdm_scripts(self.core["tox_root"])
76+
if scripts:
7677
if cmd[0] in scripts:
7778
cmd = ["pdm", "run", *cmd]
7879
return super().execute(cmd, stdin, show, cwd, run_id, executor)

tox_pdm/utils.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77

88

99
def pdm_scripts(root: Path) -> dict[str, Any]:
10-
if (pyproject_toml := root / "pyproject.toml").exists():
10+
pyproject_toml = root / "pyproject.toml"
11+
if pyproject_toml.exists():
1112
pyproject = toml.load(pyproject_toml.open("r"))
1213
return pyproject.get("tool", {}).get("pdm", {}).get("scripts", {})
1314
return {}

0 commit comments

Comments
 (0)