-
-
Notifications
You must be signed in to change notification settings - Fork 422
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Environment variable substitution in cmd
scripts
#2542
Labels
⭐ enhancement
Improvements for existing features
Comments
Currently |
No. Here is a demo of what doesn't work for me.
|
Okay, the problem is |
The scripts also succeed/fail the same way with [tool.pdm.scripts]
foo.shell = "python ${PYTHON_SOURCES}"
foo.env = { PYTHON_SOURCES = "test.py" }
bar.cmd = "python ${PYTHON_SOURCES}"
bar.env = { PYTHON_SOURCES = "test.py" } |
if you set env before executing you will find it runs successful |
frostming
added a commit
that referenced
this issue
Jan 9, 2024
Fixes #2542 Signed-off-by: Frost Ming <[email protected]>
2 tasks
frostming
added a commit
that referenced
this issue
Jan 10, 2024
* fix: Environment variable substitution in `cmd` scripts Fixes #2542 Signed-off-by: Frost Ming <[email protected]> * fix tests Signed-off-by: Frost Ming <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is your feature/enhancement proposal related to a problem? Please describe.
When I tried migrating a project's tasks from Poe the Poet, an independent task runner for Poetry, I ran into a feature that is important to me missing.
Poe can substitute environment variables in
cmd
tasks, which are like PDMcmd
scripts. Here is an example of how I use it:I find this useful because it allows you to avoid repeating yourself without invoking an external shell. Why
shell
scripts aren't a sufficient alternative: the shell depends on the platform. On Windows this is stillcmd.exe
, which has an incompatible syntax for variable substitution.Describe the solution you'd like
I would like to be able to substitute environment variables as
{env:PYTHON_SOURCES}
or something similar consistent with existing PDM syntax ({args}
and{pdm}
) incmd
scripts.The text was updated successfully, but these errors were encountered: