Reputation: 18528
As part of the installation process I would like to copy a config file to user's home directory, i.e. ~/.foo.conf
What is the usual approach to do this with setup.py
? Should I write code in setup.py
to copy the file after the setup()
, or is there some built-in mechanism in place for this kind of task?
Update
I ended up modifying the script to check if ~/.foo.conf
exists on start up.
If not, create a default conf. I also found this post which was useful.
Upvotes: 5
Views: 2607
Reputation: 156158
I think this might be a misuse of setuptools. If you want to stick to a setuptools install, you should probably look for a config file there, and advertise it loudly to your users, but if defaults are needed, they should be read from inside the package itself, using something like resource_stream
so that you can be sure you will find it no matter wether setup was run from system installed easy_install, into a virtualenv, or by a packaging system like rpm.
in the latter case, actually placing such a config file would be impractical, since the system users don't exist at the time the rpm is built.
Upvotes: 4