1

I want to distribute a Python package with setuptools. Along with the package the following should be installed:

  • a starter script
  • a .desktop file to run the start script
  • an icon for the .desktop file

I used the following setup.py file (full version is here):

from setuptools import setup

setup(
  # ...
  data_files=[
    ('share/icons/hicolor/scalable/apps', ['data/mypackage.svg']),
    ('share/applications', ['data/mypackage.desktop'])
  ],
  entry_points={
    'console_scripts': ['startit=mypackage.cli:run']
  }
)

The starter skript trough entry_points works. But the data_files where put in an egg file and not in the folders specified, so they can't be accessed by the desktop shell.

To work around this, I used the following setup.cfg file:

[install]
single-version-externally-managed=1
record=install.txt

This does work, but it kinda feels to me more like a workaround. Am I doing something wrong here?

What's the preferred way to handle this?

Brutus
  • 7,139
  • 7
  • 36
  • 41

0 Answers0