Closed jrohel closed 2 months ago
I agree with removing the else branch. It's there to support executing dnf from a git tree, but it damages sys,path[0] whenever somebody install dnf into a path different from /usr/bin. This developer-oriented hack should not exist in a production code. Developers should set PYTHONPATH from environment (or with a wrapper) instead.
(Alternatively the hack should prepend a zeroth argument of the program to sys.path instead of rewriting sys.path[0].)
I found a problem while creating PR https://github.com/rpm-software-management/dnf/pull/2074 . dnf traceback when Python is started with
-P
. I added-P
to the shebang line.-P
- Don't automatically prepend a potentially unsafe path to sys.path such as the current directory, the script's directory or an empty string.Problem is caused by the nasty hack (in "dnf.in", "dnf-automatic.in"):
How about removing it?