[setuptools] install data-file in users home-dir

c.buhtz at posteo.jp c.buhtz at posteo.jp
Fri Jul 10 03:11:04 CEST 2015


I am using setuptools to create a wheel file.

There is a conf-file I want to install into the users config-diretory.
e.g. /home/user/.config/appname/app.conf

setup(...,
      data_files = [ ('~/.config/appname/', ['app.conf']) ]
     )

I see two problems here:

1.
I don't know the users "name". So I have to use a placeholder here.
Does '~' work here in that case?

2.
To install the wheel-file with pip I need sudo-privilegs on Ubuntu
14.04.2. That means while the install script runs I can not ask for the
users name because it is "root" in that case.


More information about the Python-list mailing list