void-packages/srcpkgs/python-ipython/patches/split-pkg.patch

33 lines
1.5 KiB
Diff
Raw Normal View History

Description: don't fail startup if ipython-notebook is not installed
e.g. ipython locate triggers this code but doesn't need the notebook css files
--- IPython/core/profiledir.py
+++ IPython/core/profiledir.py
@@ -173,15 +173,18 @@ class ProfileDir(LoggingConfigurable):
self._mkdir(self.static_dir)
custom = os.path.join(self.static_dir, 'custom')
self._mkdir(custom)
- from IPython.html import DEFAULT_STATIC_FILES_PATH
- for fname in ('custom.js', 'custom.css'):
- src = os.path.join(DEFAULT_STATIC_FILES_PATH, 'custom', fname)
- dest = os.path.join(custom, fname)
- if not os.path.exists(src):
- self.log.warn("Could not copy default file to static dir. Source file %s does not exist.", src)
- continue
- if not os.path.exists(dest):
- shutil.copy(src, dest)
+ try:
+ from IPython.html import DEFAULT_STATIC_FILES_PATH
+ for fname in ('custom.js', 'custom.css'):
+ src = os.path.join(DEFAULT_STATIC_FILES_PATH, 'custom', fname)
+ dest = os.path.join(custom, fname)
+ if not os.path.exists(src):
+ self.log.warn("Could not copy default file to static dir. Source file %s does not exist.", src)
+ continue
+ if not os.path.exists(dest):
+ shutil.copy(src, dest)
+ except ImportError:
+ pass # ipython-notebook not installed
def check_dirs(self):
self.check_security_dir()