another distutils question

Keith Perkins keith at keithperkins.net
Fri Sep 29 21:38:41 EDT 2006


On Fri, 29 Sep 2006 18:57:12 -0500, Robert Kern wrote:

> Keith Perkins wrote:
> 
>> On a similar note , I have another question about distutils and data files.
>> I have a little program that uses a txt file to store data, and it works
>> fine running it in it's own folder, if I install through distutils, using
>> sudo to get it to write to the site-packages folder (which root owns), it
>> installs the data file so that it is owned by root, and not by me, so
>> that the data file can't be written to (although the script can read it).
>> Do I need to run a post install script, or add something to setup.py file
>> to chown the file or am I doing something wrong?  There doesn't seem to be
>> anything on this in the docs.  
> 
> There's nothing in distutils specifically that will let you do this. The root 
> user will have to chown/chgrp/chmod/chwhatever the package that you installed 
> manually.
> 
> You shouldn't use package data for things that are going to be modified. 
> Instead, use a directory like ~/.myscript/ or something else.

I did install it in ~/.script/data.txt, and distutils set the
user/group as root.  Is it impossible to install this with distutils?
Since I'm running setup as root, should I just add a class or method to
chown the datafolder/file to the installer. Should I use autotools
instead? I haven't looked into eggs yet would that be a better choice? The
data file is something that is necessary for the program (it reads it and
prints out a random line--the whole idea of the script)if that's all I
wanted it to do I wouldn't have any problems--I could even include it as a
list in the script file, but I would like the user to be able to add other
data. 
Thanks,
Keith



More information about the Python-list mailing list