From 21e1c5842bd16299d249ada27207595a6e69eb54 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 16 Nov 2015 10:59:14 +0530 Subject: [PATCH] A nicer way to isolate config files created during the build process --- setup/install.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/setup/install.py b/setup/install.py index f7e68cf308..68b41320e5 100644 --- a/setup/install.py +++ b/setup/install.py @@ -122,10 +122,14 @@ class Develop(Command): raise SystemExit(1) if os.geteuid() == 0: + # We drop privileges for security, regaining them when installing + # files. Also ensures that any config files created as a side + # effect of the build process are not owned by root. self.drop_privileges() - # Ensure any calibre config files are created as correct user - import calibre.utils.config as c - c + + # Ensure any config files created as a side effect of importing calibre + # during the build process are in /tmp + os.environ['CALIBRE_CONFIG_DIRECTORY'] = os.environ.get('CALIBRE_CONFIG_DIRECTORY', '/tmp/calibre-install-config') def run(self, opts): self.manifest = []