-
-
Notifications
You must be signed in to change notification settings - Fork 515
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
Support expanding globs/path wildcards in tox.ini
#1571
Comments
In my case, I implemented a workaround for my case but it's sort of ugly because it requires running a separate command for this env and doesn't allow taking advantage of commands =
{envpython} -m \
delocate.cmd.delocate_wheel \
-v \
{posargs:"{env:PEP517_OUT_DIR}"/*.whl} |
I think this is a good idea of a feature, note I personally don't plan to do work on this before tox 4... so if you want it before feel free to put in a PR. |
Note that [tox]
distshare = {toxworkdir}/distshare
[testenv:py123]
deps=
{distshare}/dep1-* Possibly this could be used with That test was added in v1.3 2db7902. However, I cant find "wildcard" or "glob" in the source. Possibly that only allowed the In any case, implementing |
Checked, and the below does not work. It also results in a literal [tox]
distshare = {toxworkdir}/distshare
[testenv:py123]
deps=
{distshare}/dep1-*
[testenv:deps_glob]
commands = ls {[testenv:py123]deps}
I do know of one way to achieve it, using my alpha grade plugin [tox]
envlist=deps_glob
requires=tox-backticks
[testenv:py123]
deps=
dist/*.whl
[testenv:deps_glob]
setenv =
FOO=`python -c 'import glob,sys; sys.stdout.write(" ".join(glob.glob(sys.argv[1])))' {[testenv:py123]deps}`
commands = echo {env:FOO} That globbing can be done using another python package. |
No need for any third-party packages. This task is quite straightforward — we just need |
Dont get me wrong (edited for clarity), I'm broadly in favour of adding explicit syntax for globbing. But it isnt in core yet. There are also significant problems with syntax in general that IMO should be fixed first, especially wrt to the replacement engine handling of characters like
If we can prevent all special characters in the Something to think through is that Python module glob introduces an extra layer of escaping:
c.f. https://docs.python.org/2/library/glob.html
A much simpler implementation detail: Which directory setting should it be relative to, if given a relative path (" |
From the github-actions configuration. We are disabling this command for now, since tox.ini doesn't support expanding globs. tox-dev/tox#1571 https://phabricator.endlessm.com/T31414
Currently, if you put a command like
delocate-wheel dist/*.whl
intox.ini
, that command (delocate-wheel
) will get"dist/*.whl"
string as its arg. But if you run it in shell, it'll get the list of matching paths.Some programs are okay with that and apply
glob
internally while others don't know how to do this. Or, in case ofdelocate
, it does it partially but has a bug where it outputs a file with an invalid filename called*.whl
.So in some cases, it's reasonable to want to expand a glob explicitly.
I suggest adding a new substitution syntax. This is what I have in mind:
commands = {envpython} -m some-command {glob:dist/*.whl} {glob:**/*.tar.gz:fallback/path/without/substitutions.txt} {env:VAR:{glob:fallback/*.zip}}
Refs:
AttributeError: 'NoneType' object has no attribute 'group'
pypa/twine#612The text was updated successfully, but these errors were encountered: