argcomplete
argcomplete copied to clipboard
test.py relies on python
Please use sys.executable instead.
What problems is this causing for you? Those parts are exercising the global completion code that is matching on python*
and pypy*
so I don't think they would work with the full path from sys.executable
.
(As you can see by the test failures in #257)
@hroncok Are you able to comment on whether this has been an issue for you when packaging for Fedora?
Somehow. We have a workaround:
sed -i -e "1s\|#!.*python.*\|#!/usr/bin/python3\|" test/prog scripts/*
sed -i -e "s\|python \|python3 \|" test/test.py
This makes sure that our packaged python3-argparse RPM is only used for our python3 things.
I have a branch which should fix these issues here: https://github.com/evanunderscore/argcomplete/commits/dynamic-test-shebang
It has a few problems:
- Moving those scripts is rather disruptive to the code base, so I'd want @kislyuk's blessing before doing something like that.
- The package now has to be installed in order to run the tests since it needs the console_scripts to be created (it could previously read them straight from the
scripts
folder). - It's difficult to work this into the CI in a way that we'd know if we broke it again in future (all of the current jobs seem to invoke the interpreter as
python
even when usingpython3
).
@hroncok Do you think it's worth pursuing this, or are you happy to keep sed
ing the code?
I think that it's worth pursuing for multiple reasons*, however I'm not sure if this is the best way. I haven't yet read the code and will not have the tiem to do it until next week.
Wearing my Fedora, we can live with the current solution. If you only motivation would be to make our packaging job easier (thanks!), it is probably not worth the effort.
* I'm not quite sure how argcomplete is supposed to work in "multiple Pythons installed" environment.
Until recently, the fact that anything under scripts/
ran in Python was an implementation detail, and provided that you could run python
they would work. Unfortunately I didn't notice that #237 now means that register-python-argcomplete
won't work unless argcomplete is installed in whatever interpreter python
refers to.
So it seems like we now have two problems:
- Systems don't necessarily have
python
installed any more - If they do, argcomplete isn't necessarily importable there
I agree these are probably worth fixing. Once you get time to take a look over my branch and confirm the changes work in your environment, we can go from there.