z411 / trackma

Open multi-site list manager for Unix-like systems. (ex-wMAL)
https://z411.github.io/trackma
GNU General Public License v3.0
761 stars 82 forks source link

Can't do setup install on my manjaro #675

Open Kcchouette opened 1 year ago

Kcchouette commented 1 year ago
$ git pull
Already up to date.
$ git status
On branch master
Your branch is up to date with 'origin/master'.

nothing to commit, working tree clean
$ sudo python setup.py install
running install
/usr/lib/python3.10/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
  warnings.warn(
/usr/lib/python3.10/site-packages/setuptools/command/easy_install.py:144: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools.
  warnings.warn(
Traceback (most recent call last):
  File "trackma/setup.py", line 20, in <module>
    setup(
  File "/usr/lib/python3.10/site-packages/setuptools/__init__.py", line 108, in setup
    return distutils.core.setup(**attrs)
  File "/usr/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 185, in setup
    return run_commands(dist)
  File "/usr/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
    dist.run_commands()
  File "/usr/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands
    self.run_command(cmd)
  File "/usr/lib/python3.10/site-packages/setuptools/dist.py", line 1213, in run_command
    super().run_command(command)
  File "/usr/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
    cmd_obj.run()
  File "/usr/lib/python3.10/site-packages/setuptools/command/install.py", line 74, in run
    self.do_egg_install()
  File "/usr/lib/python3.10/site-packages/setuptools/command/install.py", line 117, in do_egg_install
    cmd.ensure_finalized()  # finalize before bdist_egg munges install cmd
  File "/usr/lib/python3.10/site-packages/setuptools/_distutils/cmd.py", line 111, in ensure_finalized
    self.finalize_options()
  File "/usr/lib/python3.10/site-packages/setuptools/command/easy_install.py", line 311, in finalize_options
    self.local_index = Environment(self.shadow_path + sys.path)
  File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 1044, in __init__
    self.scan(search_path)
  File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 1077, in scan
    self.add(dist)
  File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 1096, in add
    dists.sort(key=operator.attrgetter('hashcmp'), reverse=True)
  File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 2631, in hashcmp
    self.parsed_version,
  File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 2685, in parsed_version
    raise packaging.version.InvalidVersion(f"{str(ex)} {info}") from None
packaging.version.InvalidVersion: Invalid version: '.9' (package: amt)
FichteFoll commented 1 year ago

First, I don't recommend installing Python packages manually with sudo because that will install files on your system that your package manager won't know about. Instead, omit the sudo to make a user installation.

Second, please try again with the updated instructions after #653 has been merged.

Third, you'd generally be more interested in installing trackma using your system's package manager and the trackma AUR package.

v-fox commented 1 year ago

First, I don't recommend installing Python packages manually with sudo because that will install files on your system that your package manager won't know about. Instead, omit the sudo to make a user installation.

Second, please try again with the updated instructions after #653 has been merged.

Third, you'd generally be more interested in installing trackma using your system's package manager and the trackma AUR package.

System package manager that installs packages built with python setup.py install which relies on setup.py which was nonchalantly nuked in https://github.com/z411/trackma/commit/084e3511673dfa9673fa6cf85c58ee8b3ef637ec How are we supposed to package it in distros now?

FichteFoll commented 1 year ago

See https://wiki.archlinux.org/title/Python_package_guidelines#Standards_based_(PEP_517) for the relevant instructions for Arch packaging (and the code of the trackma-git package).

Edit: see also the PyPA packaging guide

v-fox commented 1 year ago

See https://wiki.archlinux.org/title/Python_package_guidelines#Standards_based_(PEP_517) for the relevant instructions for Arch packaging (and the code of the trackma-git package).

Edit: see also the PyPA packaging guide

I'm using openSUSE on Open Build Service. It has %pyproject_wheel & %pyproject_install macros to supposedly replace %python_build & %python_install BUT have not seen a single official or unofficial package use it. When trying out it tried to make builds for absent versions of python without automatically pulling the dependencies and there is not obvious example to make a proper spec-file. But openSUSE manuals are traditionally written in weird impenetrable style that loses the point and may be factually wrong even when not obsolete. python-poetry-core seems to be a hard dependency for such build and it's not in any of official repos which means it has to be packaged too and for all distro-supported versions of python. And who knows what absent dependencies it may have. It's actually in the repo but was not found by web-search for some reason.

I doubt that distros would change entire way of handling python packages for an app that is barely maintained or absent from official repos altogether. Personally, for my package I just put back the removed file and left it as is.

FichteFoll commented 1 year ago

Using setup.py to install packages has been deprecated a while ago and PEP-517 is the way forward. This is nothing that is specific for trackma, it's a general movement in the Python world and setup.py is not coming back, if you ask me.

I find it concerning that OpenSUSE wouldn't have any packaging guidelines or a single package using this new build format. Unfortunately, my experience with OpenSUSE is exactly zero, so I can't provide any help with it.

txtsd commented 1 year ago

System package manager that installs packages built with python setup.py install which relies on setup.py which was nonchalantly nuked in 084e351 How are we supposed to package it in distros now?

That was me bringing the package up to Python standards. I'm sorry it's causing problems with packaging on OpenSUSE, but distros ought to move forward when standards are set.

Instead of substituting the removed setup.py back in, why not pip install --user poetry in the build process, and then use poetry to build normally?

EDIT: Did not see the edit. EDIT2: Could you also link the package?

v-fox commented 1 year ago

Using setup.py to install packages has been deprecated a while ago and PEP-517 is the way forward. This is nothing that is specific for trackma, it's a general movement in the Python world and setup.py is not coming back, if you ask me.

If trackma is the only package in the whole OBS that demands it, I'd call that very specific.

I find it concerning that OpenSUSE wouldn't have any packaging guidelines or a single package using this new build format. Unfortunately, my experience with OpenSUSE is exactly zero, so I can't provide any help with it.

openSUSE always had graphomaniac manuals that are bloated but written in obscurantist style full of inaccuracies, holes, logical leaps and obsolete incorrect statements. What's worse is that macros for using in spec-files are even more impenetrable, so working examples are the best bet. But I haven't seen any.

That was me bringing the package up to Python standards. I'm sorry it's causing problems with packaging on OpenSUSE, but distros ought to move forward when standards are set.

The adage about "Mohammad and the mountain" comes to mind.

Instead of substituting the removed setup.py back in, why not pip install --user poetry in the build process, and then use poetry to build normally?

What average users definitively should not be doing is crapping their /home directory with 3rd-party managers and unnecessary copies of dependencies. This is MacOS & Windows habit stemming from dll-hell and lack of proper system management.

EDIT2: Could you also link the package?

However, just for the heck of it, I tried out to make a working package in new style. It was a complete shit-show but in the end it worked. I present you with this ugly monstrosity which is bloated and overly complex in comparison to the original:

trackma.spec ```spec # this macro fails to generate runtime-req list, so it has to be done manually instead # while avoiding pulling all versions for runtime-reqs via {python_module } # or pulling requirements of a single "flavor" for all other flavors of subpackages # currently this is done by wrongly documented '{system_python}-' prefix hack which is incorrect # but "right" things, like {python_module } and simple 'python-' prefix, don't work at all %{?python_enable_dependency_generator} Name: trackma Version: 0.8.5+26~git20230223.642d483 Release: 0 License: GPL-3.0 Summary: Linux Anime Lists Tracker Url: http://z411.github.io/trackma BuildArch: noarch Group: Productivity/Multimedia Source0: %{name}-%{version}.tar.gz Source1: %{name}-qt.desktop Source2: %{name}-gtk.desktop Source3: setup.py BuildRequires: fdupes BuildRequires: %{python_module devel} BuildRequires: %{python_module pyinotify} BuildRequires: %{python_module pip} BuildRequires: %{python_module poetry-core} BuildRequires: %{python_module wheel} #BuildRequires: {python_module setuptools} Requires: %{system_python}-pyinotify Requires(post): update-alternatives Requires(postun): update-alternatives Requires: lsof Requires: trackma-common = %{version} Obsoletes: wmal < %{version} Obsoletes: trackma < %{version} Conflicts: trackma < %{version} Provides: trackma = %{version} %{python_subpackages} %description Trackma aims to be a lightweight and simple but feature-rich program for GNU/Linux and Unix based systems for fetching, updating and using data from personal lists hosted in different media tracking websites like MyAnimeList, Melative or VNDB. %package common Summary: Trackma's icon Group: Productivity/Multimedia Supplements: %{name} = %{version} %description common Shim-package for unskippable post-build checks to stop killing a legitimate build %package qt Summary: Qt interface for Trackma Group: Productivity/Multimedia BuildRequires: update-desktop-files Requires(post): update-alternatives Requires(postun): update-alternatives BuildRequires: %{python_module PyQt5-devel} BuildRequires: %{python_module Pillow} Requires: %{system_python}-PyQt5 Requires: %{system_python}-Pillow Requires: trackma-qt-common = %{version} Requires: %{name} = %{version} Supplements: %{name} = %{version} Obsoletes: trackma-qt < %{version} Conflicts: trackma-qt < %{version} Provides: trackma-qt = %{version} Provides: %{name}-ui = %{version} Provides: trackma-ui = %{version} Obsoletes: wmal-ui < %{version} %description qt Qt interface for Trackma, an anime lists tracker # "correct" documented way to do this is to use python_clone/prepare_alternative on those files # but it fails the build because OBS is obsessed with fiddling all desktop-files directly # and the whole thing is only needed because it demands to make all flavor packages non-conflicting for no practical reason %package qt-common Summary: Trackma-qt's desktop-file Group: Productivity/Multimedia Supplements: %{name}-qt = %{version} %description qt-common Shim-package for unskippable post-build checks to stop killing a legitimate build %package gtk Summary: GTK interface for Trackma Group: Productivity/Multimedia BuildRequires: update-desktop-files Requires(post): update-alternatives Requires(postun): update-alternatives BuildRequires: %{python_module pycairo-devel} BuildRequires: %{python_module gobject-Gdk} BuildRequires: %{python_module gobject-cairo} BuildRequires: %{python_module Pillow} Requires: %{system_python}-pycairo Requires: %{system_python}-gobject-Gdk Requires: %{system_python}-gobject-cairo Requires: %{system_python}-Pillow Requires: trackma-gtk-common = %{version} Requires: %{name} = %{version} Supplements: trackma = %{version} Obsoletes: trackma-gtk < %{version} Conflicts: trackma-gtk < %{version} Provides: trackma-gtk = %{version} Provides: %{name}-ui = %{version} Provides: trackma-ui = %{version} Obsoletes: wmal-ui < %{version} %description gtk GTK interface for Trackma, an anime lists tracker %package gtk-common Summary: Trackma-gtk's desktop-file Group: Productivity/Multimedia Supplements: %{name}-gtk = %{version} %description gtk-common Shim-package for unskippable post-build checks to stop killing a legitimate build %package curses Summary: Console interface for Trackma Group: Productivity/Multimedia Requires(post): update-alternatives Requires(postun): update-alternatives BuildRequires: %{python_module urwid} BuildRequires: %{python_module Pillow} Requires: %{system_python}-urwid Requires: %{system_python}-Pillow Requires: trackma = %{version} Supplements: trackma = %{version} Obsoletes: trackma-cli < %{version} Conflicts: trackma-cli < %{version} Provides: trackma-cli = %{version} Provides: %{name}-cli = %{version} Obsoletes: wmal-ui < %{version} %description curses Advanced сonsole interface for Trackma, an anime lists tracker %prep %autosetup -p1 cp -v %{SOURCE3} ./ %build %pyproject_wheel %install %pyproject_install %__install -dm 755 %{buildroot}%{_bindir} %__install -dm 755 %{buildroot}%{_datadir}/applications/ %__install -dm 755 %{buildroot}%{_datadir}/pixmaps/ %__install -m 644 trackma/data/icon.png \ %{buildroot}%{_datadir}/pixmaps/trackma.png %__install -m 644 %{SOURCE1} \ %{buildroot}%{_datadir}/applications/%name-qt.desktop %__install -m 644 %{SOURCE2} \ %{buildroot}%{_datadir}/applications/%name-gtk.desktop %suse_update_desktop_file -r -n -i %{name}-qt Network News %suse_update_desktop_file -r -n -i %{name}-gtk Network News %python_clone -a %{buildroot}%{_bindir}/trackma %python_clone -a %{buildroot}%{_bindir}/trackma-qt %python_clone -a %{buildroot}%{_bindir}/trackma-gtk %python_clone -a %{buildroot}%{_bindir}/trackma-curses %python_expand %fdupes %{buildroot}%{python_sitelib}/ %post %python_install_alternative trackma %postun %python_uninstall_alternative trackma %post qt %python_install_alternative trackma-qt %postun qt %python_uninstall_alternative trackma-qt %post gtk %python_install_alternative trackma-gtk %postun gtk %python_uninstall_alternative trackma-gtk %post curses %python_install_alternative trackma-curses %postun curses %python_uninstall_alternative trackma-curses %files %{python_files} %python_alternative %{_bindir}/trackma %{python_sitelib}/trackma %{python_sitelib}/trackma*dist-info %exclude %{python_sitelib}/trackma/ui/qt %exclude %{python_sitelib}/trackma/ui/gtk %exclude %{python_sitelib}/trackma/ui/curses.py* # 'files -n trackma-common' and 'files common' directives should be the same # but when {python_files} is present anywhere, they suddenly are not and build is killed %files -n trackma-common %{_datadir}/pixmaps/trackma.png %files %{python_files qt} %python_alternative %{_bindir}/trackma-qt %{python_sitelib}/trackma/ui/qt %files -n trackma-qt-common %{_datadir}/applications/trackma-qt.desktop %files %{python_files gtk} %python_alternative %{_bindir}/trackma-gtk %{python_sitelib}/trackma/ui/gtk %files -n trackma-gtk-common %{_datadir}/applications/trackma-gtk.desktop %files %{python_files curses} %python_alternative %{_bindir}/trackma-curses %{python_sitelib}/trackma/ui/curses.py* %changelog ```
txtsd commented 1 year ago

What average users definitively should not be doing is crapping their /home directory with 3rd-party managers and unnecessary copies of dependencies. This is MacOS & Windows habit stemming from dll-hell and lack of proper system management.

However, just for the heck of it, I tried out to make a working package in new style. It was a complete shit-show but in the end it worked. I present you with this ugly monstrosity which is bloated and overly complex in comparison to the original: trackma.spec

Are you even happy with openSUSE? This seems like a lot of work to get one thing building and working correctly. I've looked into OBS in the past to automate Prism Launcher builds across distros and maintained versions of distros, but the syntax and the macros really put me off.