We create a link from /var/cfengine/bin/python to a discovered system python in order to support package modules. /var/cfengine/bin is added to the end of PATH via /etc/profile.d/cfengine.sh.
On a system like RedHat 8, where the system ships with python3 by default and no target for python users enter python on the command line, tab completing it and then are confused that python points to python3.
- ARC ships with python symlinked to python3
- Fedora 31 ships with python symlinked to python3
- Red Hat 8 ships without python symlinked to anything, providing platform-python for internal tooling.
- The PEP indicates that a shebang of #!/usr/bin/env python should only be used when the script will only run inside of a virtual environment.
- The PEP also says if the python command is installed, it is expected to invoke either the same version of Python as the python3 command or as the python2 command.
- Should we avoid this confusion by changing the name of our symlinked python, e.g. /var/cfengine/bin/cfengine-selected-python? It's ugly, but also somewhat similar to RedHat providing platform-python that won't be accidentally used by people.
- NOTE: /etc/profile.d/cfengine.sh APPENDS cfengine to $PATH, so for this python symlink to be selected, users must have done something unexpected to put cfenigne in$PATH sooner.