Il giorno mar 2 ott 2018 alle 18:35, Adam Williamson
<adamwill(a)fedoraproject.org> ha scritto:
On Tue, 2018-10-02 at 16:30 +0200, Federico Bruni wrote:
> Hi folks
>
> While trying to figure out a way to install some desktop specific
> files
> (such as APP.desktop or APP.appdata.xml) within the installation
> prefix
> (instead of python installation) using setuptools, I started
> wondering
> if it's actually a good idea.
> Is this something that should be handled by Linux packagers (as it
> is
> now)?
>
> The application I'm working on (upstream) to improve the desktop
> related files is Frescobaldi.
> As you can see here¹, the desktop file is copied in the right
> directory thanks to the spec file.
>
> Some reasons to keep this behaviour:
>
> - setuptools doesn't provide a way to uninstall a package so you
> have
> to do it manually, while a package removes all the installed files
> - if you want to run a python package from source, there's no need
> to
> install it
>
> I'd be interested to know your thoughts.
FWIW, I've both done it and *not* done it, and my thoughts were
similar
to yours. You can make it work but it's not the best thing in the
world.
For really simple things I'd say it's probably OK, just include a
warning about the uninstall problem - there is kinda a workaround for
that, IIRC, you can use pip to uninstall the module and it'll wipe the
data files too.
I had a look at it yesterday, while trying to figure out how setuptools
was using data_files.
This page helped me a lot:
https://packaging.python.org/tutorials/packaging-projects/#generating-dis...
I think I should not use absolute path for files defined in data_files,
since they will be prepended by different directories, depending on the
distribution archive you want to generate. Interestingly, the archive
for a Linux installation contains the correct paths to the data_files.
See my comment here:
https://github.com/wbsoft/frescobaldi/issues/673#issuecomment-426565727
I cannot remember how I created the NAME-linux-x86_64.tar.gz file
though :( (note the x86_64 part, it's not a source archive)
For more complicated things you might want to consider shipping a
more
generic deployment process using a Makefile or something, which calls
setup.py but installs and removes the other bits itself.
This will be the way to go, as the project needs a build tool anyway
for a number of tasks. I'll probably go for Meson.
Thanks
Federico