Taiko2k / Tauon

The music player of today! :city_sunrise:
https://tauonmusicbox.rocks
GNU General Public License v3.0
1.64k stars 64 forks source link

Improve support for more easy packaging from Linux distros #1086

Closed stkw0 closed 3 months ago

stkw0 commented 5 months ago

Closes: #828

stkw0 commented 5 months ago

It should be ready now :)

Taiko2k commented 5 months ago

Does this work, like have you tested this? Also don't mind my ignorance but could you explain to me what setup.py does in this instance?

stkw0 commented 5 months ago

Does this work, like have you tested this? Also don't mind my ignorance but could you explain to me what setup.py does in this instance?

Yes, I have been testing it. There is still room for improvement. Currently the setup.py allows to easily build and install the t_module in the standard path. This allows tauon.py script to find t_module when importing it. I saw that for Linux it was imported manually, I don't know if the issue is still pressent but seems to work.

In the package I made for tauon the assets, themes and templates are installed in /usr/share/TauonMusicBox. The python part is installed in the standard python paths and the tauon.py is installed in /usr/bin/tauon.py.

Some things that can be improved, for example make setup.py also install input.txt and assets. But I'm not sure about it

Taiko2k commented 5 months ago

FYI the input.txt is a template and not intended to be modified, only the copy that gets put in the user data folder. So I guess it goes with other static assets.

Also consider the compile translations script, dunno if that should be automatic.

Also note there may be some dependencies missing from the requirements txt, such as pygobject. Im not sure how system provided python packages vs pip provided packages should work.

stkw0 commented 5 months ago

Thanks, in the draft for the package I forgot about the translations, tomorrow I will add it as long as other misc files like the desktop file and such, but that's an issue of package manager side. What I was also considering was adding the possibility to load the phazor.so shared library from /usr/lib{64} instead of install_directory + /lib, for now I create a symlink to install_directory + /lib/.

About the other dependencies, I think the standard approach (from user point of view) is to let the package manager handled the dependencies to avoid needing pip or any other solution requiring two (or more) system-wide package managers simultaneously. From the development perspective I think usually what is done is to create a virtual environment isolated from the rest of the system. This way both things can exist at the same time without colliding with one another.

stkw0 commented 5 months ago

At the end also changed how the phazor.so is loaded:aud = ctypes.cdll.LoadLibrary("libphazor.so") By removing the hardcoded path we ensure that it search the library on the standard LD_LIBRARY_PATH avoiding workarounds while maintaining compatibility. First it checks from install_directory/lib/libphazor.so anyway to ensure compatibility, but maybe it could be removed. I don't know how the phazor components is handled on Windows.

Taiko2k commented 4 months ago

Its exactly the same path on Windows, just the lib/libphazor.so file is actually a compiled dll.

stkw0 commented 4 months ago

I see. So the .so file can actually be a .dll, right? In any case with the current implementation it is compatible with the previous behavior, but if it fails to find the .so then it looks at the standard paths.

btw, given that phazor seems to be designed and used only for Tauron, have you thought about using pybind11 or other similar library and make it a python module? This way you could use import phazor as any python module. Then the compilation of this module could be integrated into setup.py which could make the building and the usage of phazor component more straightforward. Which could aid in making the releases for Windows, Mac, Flatpak and also makes it more trivial to package.

I like very much the approach and the objectives of this project and was surprised to see that almost no Linux distribution has a package for it. I believe that this little changes can improve overall the availability of this amazing project to other potential users.

stkw0 commented 3 months ago

The Gentoo package has been using this patch for a while. I had no issues with it nor received any bugs about it. Could it be merged?