I created a python package installation with a setup.py, and i want it to copy a data file in the folder (created for the occasion) ~/.did. The problem is that i have to call setup.py with sudo rights, as it writes in /usr/local/... So when my data file is copied in ~/.did, only the root user has write access to the file.
I decided then to add a call to os.chmod() after the setup() function, but i'd like to know if anyone had a more clean way to do so.
Here is my setup.py file :
#!/usr/bin/env python
from distutils.core import setup
import os
home=os.path.expanduser('~')
setup(name='did',
version='1.0',
description='Daily Image Downloader',
author='Luc Mazon',
author_email='my@mail.com',
url='',
license='GNU GPL v3',
scripts=['did'],
packages=['didlib'],
data_files=[
('/usr/share/man/man1', ['doc/did.1.gz']),
(home+'/.did', ['did.xml'])
]
)
os.chmod(home+'/.did/did.xml', 0666)
As did.xml is not a python file, i also created a MANIFEST.in file with the following line in it :
include did.xml
The global structure of my package is the following :
did-1.0
| didlib
| | __init__.py
| | variouspyfiles.py
| doc
| |-did.1.gz
| MANIFEST.in
| did.xml
| did
| setup.py