I am trying to add a configuration file to a python package. I want the configuration file to be placed in /etc/package-name/ but so far I was unable to do so.
The package structure is following, config.json is in the root directory and I am using python 2.7.12
├── config.json
├── installer
│ ├── child.py
│ ├── __init__.py
│ ├── install.py
├── MANIFEST.in
├── README.md
└── setup.py
I have tried few things. At first, I have added this line to setup.py which should ensure that the config.json is placed in the correct location.
setup(...,
data_files = [('/etc/beacons-node-installer/', ['config.json'])],
...)
But when it was not working I have added also package_dir and package_data variables:
setup(...,
package_dir={'installer': 'installer'},
package_data={'installer': ['config.json']},
data_files = [('/etc/beacons-node-installer/', ['config.json'])],
...)
After reading some python documentation I have noticed that version 2.7 changed few things and probably it is necessary to add file to MANIFEST.in so I tried this line
include config.json
Even this hasn't helped so now I am quite clueless. What is the correct way to install configuration file under /etc directory with pip?