redhat-performance / tuned

Tuning Profile Delivery Mechanism for Linux
GNU General Public License v2.0
755 stars 171 forks source link

Drop `-s` from the launch script shebangs #600

Open superm1 opened 5 months ago

superm1 commented 5 months ago

Running make install as suggested by INSTALL will place all the python modules in /usr/local which won't be included in the search path when -s is used in the shebang.

Closes: https://github.com/redhat-performance/tuned/issues/599

yarda commented 5 months ago

This seems like python bug. According to the [1]:

-s Don’t add the user site-packages directory to sys.path.

From the [2]:

Default value is ~/.local/lib/pythonX.Y/site-packages

On my system (fedora 39):

import site

print(site.USER_SITE)

prints:

/home/yarda/.local/lib/python3.12/site-packages

I think we generally want the -s. I will probably open python bug to sort it out and if it's wanted behavior I will ask them to fix the python documentation.

[1] https://docs.python.org/3/using/cmdline.html#cmdoption-s [2] https://docs.python.org/3/library/site.html#site.USER_SITE

yarda commented 5 months ago

You can workaround it by installation into system sitelib, e.g.:

# make install PYTHON_SITELIB=/usr/lib/python3.12/site-packages

Or whatever the system sitelib on your distro is.

superm1 commented 5 months ago

I think we generally want the -s. I will probably open python bug to sort it out and if it's wanted behavior I will ask them to fix the python documentation.

It's also a bit weird that make install has some stuff ignoring PREFIX entirely and putting things in /usr and /etc

You can workaround it by installation into system sitelib, e.g.:

Yeah that works (Fedora 39).

yarda commented 5 months ago

I think we generally want the -s. I will probably open python bug to sort it out and if it's wanted behavior I will ask them to fix the python documentation.

It's also a bit weird that make install has some stuff ignoring PREFIX entirely and putting things in /usr and /etc

For /usr it's probably bug, that should be fixed, for /etc it probably isn't. The default PREFIX for user builds is /usr/local for distro builds it's /usr. For prefix addition to /etc you need to use DESTDIR.

You can workaround it by installation into system sitelib, e.g.:

Yeah that works (Fedora 39).

rpmbuild/mock does some magic to set the prefix automatically to /usr when packages are built through it.