Show More
@@ -39,7 +39,7 b' from IPython.config.loader import ConfigFileNotFound' | |||||
39 | from IPython.core import release, crashhandler |
|
39 | from IPython.core import release, crashhandler | |
40 | from IPython.core.profiledir import ProfileDir, ProfileDirError |
|
40 | from IPython.core.profiledir import ProfileDir, ProfileDirError | |
41 | from IPython.utils.path import get_ipython_dir, get_ipython_package_dir |
|
41 | from IPython.utils.path import get_ipython_dir, get_ipython_package_dir | |
42 | from IPython.utils.traitlets import List, Unicode, Type, Bool, Dict, Set |
|
42 | from IPython.utils.traitlets import List, Unicode, Type, Bool, Dict, Set, Instance | |
43 |
|
43 | |||
44 | #----------------------------------------------------------------------------- |
|
44 | #----------------------------------------------------------------------------- | |
45 | # Classes and functions |
|
45 | # Classes and functions | |
@@ -133,6 +133,15 b' class BaseIPythonApplication(Application):' | |||||
133 | the environment variable IPYTHONDIR. |
|
133 | the environment variable IPYTHONDIR. | |
134 | """ |
|
134 | """ | |
135 | ) |
|
135 | ) | |
|
136 | _in_init_profile_dir = False | |||
|
137 | profile_dir = Instance(ProfileDir) | |||
|
138 | def _profile_dir_default(self): | |||
|
139 | # avoid recursion | |||
|
140 | if self._in_init_profile_dir: | |||
|
141 | return | |||
|
142 | # profile_dir requested early, force initialization | |||
|
143 | self.init_profile_dir() | |||
|
144 | return self.profile_dir | |||
136 |
|
145 | |||
137 | overwrite = Bool(False, config=True, |
|
146 | overwrite = Bool(False, config=True, | |
138 | help="""Whether to overwrite existing config files when copying""") |
|
147 | help="""Whether to overwrite existing config files when copying""") | |
@@ -258,6 +267,7 b' class BaseIPythonApplication(Application):' | |||||
258 |
|
267 | |||
259 | def init_profile_dir(self): |
|
268 | def init_profile_dir(self): | |
260 | """initialize the profile dir""" |
|
269 | """initialize the profile dir""" | |
|
270 | self._in_init_profile_dir = True | |||
261 | try: |
|
271 | try: | |
262 | # location explicitly specified: |
|
272 | # location explicitly specified: | |
263 | location = self.config.ProfileDir.location |
|
273 | location = self.config.ProfileDir.location | |
@@ -302,6 +312,7 b' class BaseIPythonApplication(Application):' | |||||
302 |
|
312 | |||
303 | self.profile_dir = p |
|
313 | self.profile_dir = p | |
304 | self.config_file_paths.append(p.location) |
|
314 | self.config_file_paths.append(p.location) | |
|
315 | self._in_init_profile_dir = False | |||
305 |
|
316 | |||
306 | def init_config_files(self): |
|
317 | def init_config_files(self): | |
307 | """[optionally] copy default config files into profile dir.""" |
|
318 | """[optionally] copy default config files into profile dir.""" |
General Comments 0
You need to be logged in to leave comments.
Login now