From c4f232b967eb0ad8b9ab0b230149ed8eb6dc613f Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Thu, 27 Aug 2015 18:43:39 -0400 Subject: [PATCH] linux installer: ensure python libdir exists When using a staging root, the environment module failed to install. --- setup/install.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/setup/install.py b/setup/install.py index 9c1f734918..49ec7f7afe 100644 --- a/setup/install.py +++ b/setup/install.py @@ -141,12 +141,14 @@ class Develop(Command): def install_env_module(self): import distutils.sysconfig as s libdir = s.get_python_lib(prefix=self.opts.staging_root) - if os.path.exists(libdir): + try: + if not os.path.exists(libdir): + os.makedirs(libdir) path = os.path.join(libdir, 'init_calibre.py') self.info('Installing calibre environment module: '+path) with open(path, 'wb') as f: f.write(HEADER.format(**self.template_args())) - else: + except: self.warn('Cannot install calibre environment module to: '+libdir) def install_files(self): @@ -331,4 +333,3 @@ class Bootstrap(Command): def run(self, opts): self.info('\n\nAll done! You should now be able to run "%s setup.py install" to install calibre' % sys.executable) -