What would be a cross-platform way of shipping data_files
with setup.py
(compatible with pip
)?
From the official documentation, one needs to write:
setup(...,
data_files=[('bitmaps', ['bm/b1.gif', 'bm/b2.gif']),
('config', ['cfg/data.cfg']),
('/etc/init.d', ['init-script'])]
)
and 'bitmaps'
, etc. are the sub-directories where those files should go (relative to sys.prefix
).
However, this is sub-optimal for cross-platform installations where the standard sub-dir will depend on the system. Additionally, installing the package in developer mode will not place the files where they will later be after the installation, making this process of finding/using resources ultimately hard / annoying to debug.
I have looked into appdirs
, but it seems difficult to make it work properly during installation, e.g. if using the user directory for data this gets actually tied to my development environment.
The reason I am asking this is because I have a small Python package that implements a simple GUI and I would like to ship an icon with it.
For the record, I am OK with processing setup.py
with setuptools
.