Closed Interpause closed 2 years ago
Hi @Interpause, thanks for the feedback.
Could you help me understand exactly what you want vs what's happening here?
From what I gather you want a cmd task to execute a command like pyinstaller 'path/to/*_script.py'
such that the pyinstaller executable is called with argv ["path/to/*_script.py"]
, i.e. without the single quotes but also with the glob pattern as you provided it.
I think this should be achievable by defining a task like so:
install = "pyinstaller 'path/to/*_script.py'"
Unless I'm missing something? Maybe this doesn't work quite as expected on windows? (I'm afraid I don't have easy access to a windows env for manual testing).
The goal here is that poe tries to imitate a limited subset of POSIX shell syntax for basic features like globbing, variables. and escaping. I'd be keen to understand if this model is flawed somehow. If it is then one workaround might be to use a shell task, though this creates a dependency on bash or another specific shell being present.
Also it looks like the behaviour you encountered whereby --add-data='somedir\*.txt'
doesn't work as expected it actually a bug in poethepoet but I don't think this is the main issue here.
Essentially, PyInstaller seems to be receiving "'*_script.py'"
instead of "*_script.py"
, at least when specifying keyword arguments like --add-dir '*.script.py'
. I am not sure if it is a problem with the way PyInstaller reads arguments or how poe parses the command.
But the guy over at PyInstaller did post a workaround that I should have found if I was reading poe's documentation more carefully.
Hi @Interpause,
I'm still not sure whether there is actually a problem to fix in poe for your use case. If there is then I'd like to understand what's going on.
My expectations of how a cmd task would behave are as follows:
cmd = "tool *.py"
, tool will receive the list of files matching the *.py
pattern (which could be empty)cmd = "tool '*.py'"
, tool will receive *.py
cmd = "tool \"*.py\""
, tool will receive *.py
cmd = "tool \"'*.py'\""
, tool will receive '*.py'
cmd = "tool \"'*.py'\""
, tool will receive the list of files matching the '*.py'
pattern including the quotes (which is probably empty)This is intended to closely resemble the behaviour one would expect if a POSIX shell were involved.
As you discovered there is a mishandled edge case where if the single quotes start or end within a word then the contained globs are not escaped. This should be fixed.
Does this completely explain what you've observed? Or is there some other scenario that you can describe that you don't think is covered properly?
Yeah I think that covers it, thanks
Would it possible to add a variable that allows disabling path expansion using asterisk? See https://github.com/pyinstaller/pyinstaller/issues/6751 for why. Thanks!