From e95520eb7783b53566af38739ce9eea7c6f45ce8 Mon Sep 17 00:00:00 2001 From: Frost Ming Date: Fri, 18 Oct 2024 21:04:11 +0800 Subject: [PATCH] fix: override provided via env var not working Signed-off-by: Frost Ming --- news/3182.bugfix.md | 1 + src/pdm/cli/options.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 news/3182.bugfix.md diff --git a/news/3182.bugfix.md b/news/3182.bugfix.md new file mode 100644 index 0000000000..284582bfd8 --- /dev/null +++ b/news/3182.bugfix.md @@ -0,0 +1 @@ +Fix a bug that overrides provided by environment variables do not work. diff --git a/src/pdm/cli/options.py b/src/pdm/cli/options.py index 56a8bee74e..87c137d8d3 100644 --- a/src/pdm/cli/options.py +++ b/src/pdm/cli/options.py @@ -513,7 +513,7 @@ def non_interactive_option( override_option = Option( "--override", - default=os.getenv("PDM_OVERRIDE"), + default=[env] if (env := os.getenv("PDM_OVERRIDE")) else None, action="append", help="Use the constraint file in pip-requirements format for overriding. [env var: PDM_OVERRIDE] " "This option can be used multiple times. "