##// END OF EJS Templates
Fix warning on startup if user didn't have personal copies of cluster config....
Fernando Perez -
Show More
@@ -20,6 +20,7 b' from __future__ import with_statement'
20 import os
20 import os
21 import shutil
21 import shutil
22 import sys
22 import sys
23 import warnings
23
24
24 from twisted.python import log
25 from twisted.python import log
25
26
@@ -27,13 +28,25 b' from IPython.core import release'
27 from IPython.config.loader import PyFileConfigLoader
28 from IPython.config.loader import PyFileConfigLoader
28 from IPython.core.application import Application
29 from IPython.core.application import Application
29 from IPython.core.component import Component
30 from IPython.core.component import Component
31 from IPython.utils.genutils import get_ipython_dir, get_ipython_package_dir
30 from IPython.utils.traitlets import Unicode, Bool
32 from IPython.utils.traitlets import Unicode, Bool
31 from IPython.utils import genutils
33 from IPython.utils import genutils
32
34
33 #-----------------------------------------------------------------------------
35 #-----------------------------------------------------------------------------
34 # Imports
36 # Warnings control
35 #-----------------------------------------------------------------------------
37 #-----------------------------------------------------------------------------
38 # Twisted generates annoying warnings with Python 2.6, as will do other code
39 # that imports 'sets' as of today
40 warnings.filterwarnings('ignore', 'the sets module is deprecated',
41 DeprecationWarning )
36
42
43 # This one also comes from Twisted
44 warnings.filterwarnings('ignore', 'the sha module is deprecated',
45 DeprecationWarning)
46
47 #-----------------------------------------------------------------------------
48 # Classes and functions
49 #-----------------------------------------------------------------------------
37
50
38 class ClusterDirError(Exception):
51 class ClusterDirError(Exception):
39 pass
52 pass
@@ -352,9 +365,6 b' class ApplicationWithClusterDir(Application):'
352 self.default_config.Global.cluster_dir = self.cluster_dir
365 self.default_config.Global.cluster_dir = self.cluster_dir
353 self.command_line_config.Global.cluster_dir = self.cluster_dir
366 self.command_line_config.Global.cluster_dir = self.cluster_dir
354
367
355 # Set the search path to the cluster directory
356 self.config_file_paths = (self.cluster_dir,)
357
358 def find_config_file_name(self):
368 def find_config_file_name(self):
359 """Find the config file name for this application."""
369 """Find the config file name for this application."""
360 # For this type of Application it should be set as a class attribute.
370 # For this type of Application it should be set as a class attribute.
@@ -362,8 +372,11 b' class ApplicationWithClusterDir(Application):'
362 self.log.critical("No config filename found")
372 self.log.critical("No config filename found")
363
373
364 def find_config_file_paths(self):
374 def find_config_file_paths(self):
365 # Set the search path to the cluster directory
375 # Include our own config directory last, so that users can still find
366 self.config_file_paths = (self.cluster_dir,)
376 # our shipped copies of builtin config files even if they don't have
377 # them in their ipython cluster directory.
378 conf_dir = os.path.join(get_ipython_package_dir(), 'config', 'default')
379 self.config_file_paths = (self.cluster_dir, conf_dir)
367
380
368 def pre_construct(self):
381 def pre_construct(self):
369 # The log and security dirs were set earlier, but here we put them
382 # The log and security dirs were set earlier, but here we put them
General Comments 0
You need to be logged in to leave comments. Login now