rpm-software-management / dnf

Package manager based on libdnf and libsolv. Replaces YUM.
GNU General Public License v2.0
1.22k stars 405 forks source link

Do not add user site-packages directory to sys.path (RHEL-26646) #2074

Closed jrohel closed 3 months ago

jrohel commented 3 months ago

Adds -s to shebang lines. The -s flag ensures that the user’s Python packages (e.g. installed by pip install --user) don’t interfere with the RPM installed software. According to Fedora Python Packaging Guidelines, the flag is added using %py3_shebang_fix macro.

Note: DNF supports plugins. There is a risk that the change will break a custom plugins that require something from PIP. Therefore, the change is only in the .spec file and is only allowed for Fedora >= 41 and RHEL >= 10.

ppisar commented 3 months ago

Adds -s to shebang lines. The -s flag ensures that the user’s Python packages (e.g. installed by pip install --user, or just placed in the current directory)

Current directory is controlled by -P option. Not -s option. Remove these words from the commit message.

jrohel commented 3 months ago

@ppisar

Current directory is controlled by -P option.

Probably not just the current directory. Python Packaging Guidelines https://docs.fedoraproject.org/en-US/packaging-guidelines/Python/#_shebangs states (I'll comment the code):

# Don't add -P to Python shebangs
# The executable Python scripts in /usr/share/opt-viewer/ import each other
%undefine _py3_shebang_P

Anyway, I copied the text from the Python Packaging Guidelines and they probably have a mistake in the description (I found another error there already yesterday). I delete or just placed in the current directory from the text. Thanks for the notice.