I created the installation of the python package with setup.py, and I want it to copy the data file to the folder (created for the case) ~ / .did. The problem is that I have to call setup.py with sudo privileges because it writes to / usr / local / ... Therefore, when my data file is copied to ~ / .did, only the root user has write access to the file,
Then I decided to add the os.chmod () call after the setup () function, but I would like to know if anyone has a cleaner way to do this.
Here is my setup.py file:
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)
Like .xml is not a python file, I also created a MANIFEST.in file with the following line:
include did.xml
The global structure of my package is as follows:
did-1.0
| didlib
| | __init__.py
| | variouspyfiles.py
| doc
| |-did.1.gz
| MANIFEST.in
| did.xml
| did
| setup.py
source
share