argcomplete icon indicating copy to clipboard operation
argcomplete copied to clipboard

test.py relies on python

Open ignatenkobrain opened this issue 5 years ago • 6 comments

Please use sys.executable instead.

ignatenkobrain avatar Aug 12 '18 14:08 ignatenkobrain

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)

evanunderscore avatar Aug 15 '18 02:08 evanunderscore

@hroncok Are you able to comment on whether this has been an issue for you when packaging for Fedora?

evanunderscore avatar Apr 10 '19 12:04 evanunderscore

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.

hroncok avatar Apr 10 '19 12:04 hroncok

I have a branch which should fix these issues here: https://github.com/evanunderscore/argcomplete/commits/dynamic-test-shebang

It has a few problems:

  1. Moving those scripts is rather disruptive to the code base, so I'd want @kislyuk's blessing before doing something like that.
  2. 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).
  3. 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 using python3).

@hroncok Do you think it's worth pursuing this, or are you happy to keep seding the code?

evanunderscore avatar Apr 13 '19 08:04 evanunderscore

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.

hroncok avatar Apr 13 '19 16:04 hroncok

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.

evanunderscore avatar Apr 14 '19 03:04 evanunderscore