On 10 July 2015 at 03:11, <c.bu...@posteo.jp> wrote: > 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?
It doesn’t. You would have to use os.path.expanduser, but don’t do that. > 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. > -- > https://mail.python.org/mailman/listinfo/python-list You should NEVER use sudo with pip. Instead, use virtualenvs as a regular user, or create your own .deb packages. And you should not create the files in your install script. Instead, install them to a different data dir (somewhere in 'share/appname', or alongside your package). When someone runs your app, only then you should copy this file to user’s config directory (use pkg_resources to help you get it) if it does not exist yet. -- Chris Warrick <https://chriswarrick.com/> PGP: 5EAAEA16 -- https://mail.python.org/mailman/listinfo/python-list