##// END OF EJS Templates
allow startup files in system-wide config dirs...
Min RK -
Show More
@@ -8,12 +8,14 b' launch InteractiveShell instances, load extensions, etc.'
8 # Distributed under the terms of the Modified BSD License.
8 # Distributed under the terms of the Modified BSD License.
9
9
10 import glob
10 import glob
11 from itertools import chain
11 import os
12 import os
12 import sys
13 import sys
13
14
14 from traitlets.config.application import boolean_flag
15 from traitlets.config.application import boolean_flag
15 from traitlets.config.configurable import Configurable
16 from traitlets.config.configurable import Configurable
16 from traitlets.config.loader import Config
17 from traitlets.config.loader import Config
18 from IPython.core.application import SYSTEM_CONFIG_DIRS, ENV_CONFIG_DIRS
17 from IPython.core import pylabtools
19 from IPython.core import pylabtools
18 from IPython.utils.contexts import preserve_keys
20 from IPython.utils.contexts import preserve_keys
19 from IPython.utils.path import filefind
21 from IPython.utils.path import filefind
@@ -324,7 +326,9 b' class InteractiveShellApp(Configurable):'
324
326
325 def _run_startup_files(self):
327 def _run_startup_files(self):
326 """Run files from profile startup directory"""
328 """Run files from profile startup directory"""
327 startup_dir = self.profile_dir.startup_dir
329 startup_dirs = [self.profile_dir.startup_dir] + [
330 os.path.join(p, 'startup') for p in chain(ENV_CONFIG_DIRS, SYSTEM_CONFIG_DIRS)
331 ]
328 startup_files = []
332 startup_files = []
329
333
330 if self.exec_PYTHONSTARTUP and os.environ.get('PYTHONSTARTUP', False) and \
334 if self.exec_PYTHONSTARTUP and os.environ.get('PYTHONSTARTUP', False) and \
@@ -336,9 +340,9 b' class InteractiveShellApp(Configurable):'
336 except:
340 except:
337 self.log.warning("Unknown error in handling PYTHONSTARTUP file %s:", python_startup)
341 self.log.warning("Unknown error in handling PYTHONSTARTUP file %s:", python_startup)
338 self.shell.showtraceback()
342 self.shell.showtraceback()
339
343 for startup_dir in startup_dirs[::-1]:
340 startup_files += glob.glob(os.path.join(startup_dir, '*.py'))
344 startup_files += glob.glob(os.path.join(startup_dir, '*.py'))
341 startup_files += glob.glob(os.path.join(startup_dir, '*.ipy'))
345 startup_files += glob.glob(os.path.join(startup_dir, '*.ipy'))
342 if not startup_files:
346 if not startup_files:
343 return
347 return
344
348
General Comments 0
You need to be logged in to leave comments. Login now