How to write UNIX daemons in Python?

"Martin v. Löwis" martin at v.loewis.de
Wed Sep 13 11:38:29 EDT 2006


gnewsg at gmail.com schrieb:
> What should I use to do something like that? Do I have to use
> distutils? Do I have to use third party packages? Do I have to write a
> "setup.py" and solve the problem manually?
> This last solution is problematic becouse, for (dumb) example, Debian
> wants executable/programs to be located in /usr/bin while Fedora uses
> another path (for example /usr/sbin).
> 
> Another question: what about .deb, .rpm, [...] packages?
> Does it possible to use them with Python programs?
> Resolving third party dependancies by using them could be a nice thing.

I would create packages, and therefore restrict attention to the
systems that are to be supported.

For RPM, there is a distutils bdist_rpm command which can help in
generating the RPM. OTOH, it might be actually easier to write a .spec
file and build the RPM "manually".

For .deb, there is also a bdist_deb distutils command (although not
part of the standard Python distribution), again, it is likely easier
to use the standard Debian packaging tool chain (i.e. with an
explicit debian/ subdirectory, initially populated with dh_make).

In either case, it is probably a good idea to look at source packages
to get started quickly.

FWIW, Debian does *not* put daemon programs in /usr/bin. Debian
follows the FHS, which specifies that system binaries go into
/usr/sbin. /usr/bin is limited to user programs.

Regards,
Martin



More information about the Python-list mailing list