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