A nicer way to isolate config files created during the build process

This commit is contained in:
Kovid Goyal 2015-11-16 10:59:14 +05:30
parent 15cbf73fc5
commit 21e1c5842b

View File

@ -122,10 +122,14 @@ class Develop(Command):
raise SystemExit(1) raise SystemExit(1)
if os.geteuid() == 0: 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() self.drop_privileges()
# Ensure any calibre config files are created as correct user
import calibre.utils.config as c # Ensure any config files created as a side effect of importing calibre
c # 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): def run(self, opts):
self.manifest = [] self.manifest = []