I'm trying to find a nice way to ship default configuration files with my python setuptools project.
For now I'm doing it like this:
from setuptools import setup
setup(
...
data_files = [('/usr/local/etc', ['files/myproject.conf', ...])]
...
)
The problem is that the configuration files are erased if I uninstall my package. Usually, when uninstalling a package on Linux or FreeBSD, the configuration files are not deleted. I think this is good, because sometimes you just want to uninstall a package to reinstall another version, or to install it with other options etc... You don't expect your configurations files to be deleted.
How to achieve the same with setuptools? How to install configurations files only if they don't already exist?