[Distutils] distutils extension for dbus service files

Lukas Hetzenecker lukas.hetzenecker at gmail.com
Tue Feb 15 17:43:07 CET 2011


Hello,

I've created an extension for distutils which reads D-Bus *.service.in files, 
replaces macros in these files (e.g. @bindir@) and copies them to the 
appropriate location (e. g. /usr/share/dbus-1/services/ or 
$HOME/.local/share/dbus-1/services in user-mode). 

I couldn't find much useful information for this task in the distutils 
documentation, so I tried to accomplish this by reading through the source 
code of the distutils commands.

Is the attached python script the right way to handle this situation or could 
this be achieved easier?
If this is the correct way to do this I'll also write similar methods for 
handling PyQt4 ui and translation files.

This is an example for a setup.py script

from oms_distutils import setup
setup(name='example',
      version='1.0',
      package_dir={'example': 'src'},
      packages=['example.lib'],
      dbus_files=['data/com.example.test.service.in'],
      )

And this is the com.example.test.service.in file:
[D-BUS Service]
Name=com.example.test
Exec=@bindir@/example-wrapper


Thanks for your comments,
Lukas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: oms_distutils.py
Type: text/x-python
Size: 6237 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/distutils-sig/attachments/20110215/0d73ac88/attachment.py>


More information about the Distutils-SIG mailing list