Show More
@@ -3,7 +3,7 b'' | |||
|
3 | 3 | An application for IPython. |
|
4 | 4 | |
|
5 | 5 | All top-level applications should use the classes in this module for |
|
6 |
handling configuration and creating co |
|
|
6 | handling configuration and creating configurables. | |
|
7 | 7 | |
|
8 | 8 | The job of an :class:`Application` is to create the master configuration |
|
9 | 9 | object and then create the configurable objects, passing the config to them. |
@@ -17,7 +17,7 b' Authors:' | |||
|
17 | 17 | """ |
|
18 | 18 | |
|
19 | 19 | #----------------------------------------------------------------------------- |
|
20 |
# Copyright (C) 2008 |
|
|
20 | # Copyright (C) 2008 The IPython Development Team | |
|
21 | 21 | # |
|
22 | 22 | # Distributed under the terms of the BSD License. The full license is in |
|
23 | 23 | # the file COPYING, distributed as part of this software. |
@@ -28,6 +28,7 b' Authors:' | |||
|
28 | 28 | #----------------------------------------------------------------------------- |
|
29 | 29 | |
|
30 | 30 | import atexit |
|
31 | import errno | |
|
31 | 32 | import glob |
|
32 | 33 | import logging |
|
33 | 34 | import os |
@@ -126,7 +127,7 b' class BaseIPythonApplication(Application):' | |||
|
126 | 127 | get_ipython_package_dir(), u'config', u'profile', new |
|
127 | 128 | ) |
|
128 | 129 | |
|
129 |
ipython_dir = Unicode( |
|
|
130 | ipython_dir = Unicode(config=True, | |
|
130 | 131 | help=""" |
|
131 | 132 | The name of the IPython directory. This directory is used for logging |
|
132 | 133 | configuration (through profiles), history storage, etc. The default |
@@ -134,6 +135,11 b' class BaseIPythonApplication(Application):' | |||
|
134 | 135 | the environment variable IPYTHONDIR. |
|
135 | 136 | """ |
|
136 | 137 | ) |
|
138 | def _ipython_dir_default(self): | |
|
139 | d = get_ipython_dir() | |
|
140 | self._ipython_dir_changed('ipython_dir', '', d) | |
|
141 | return d | |
|
142 | ||
|
137 | 143 | _in_init_profile_dir = False |
|
138 | 144 | profile_dir = Instance(ProfileDir) |
|
139 | 145 | def _profile_dir_default(self): |
@@ -179,10 +185,6 b' class BaseIPythonApplication(Application):' | |||
|
179 | 185 | self.log.error("Current working directory doesn't exist.") |
|
180 | 186 | raise |
|
181 | 187 | |
|
182 | # ensure even default IPYTHONDIR exists | |
|
183 | if not os.path.exists(self.ipython_dir): | |
|
184 | self._ipython_dir_changed('ipython_dir', self.ipython_dir, self.ipython_dir) | |
|
185 | ||
|
186 | 188 | #------------------------------------------------------------------------- |
|
187 | 189 | # Various stages of Application creation |
|
188 | 190 | #------------------------------------------------------------------------- |
@@ -214,9 +216,17 b' class BaseIPythonApplication(Application):' | |||
|
214 | 216 | if not os.path.isdir(new): |
|
215 | 217 | os.makedirs(new, mode=0o777) |
|
216 | 218 | readme = os.path.join(new, 'README') |
|
217 | if not os.path.exists(readme): | |
|
218 | path = os.path.join(get_ipython_package_dir(), u'config', u'profile') | |
|
219 |
shutil.copy( |
|
|
219 | readme_src = os.path.join(get_ipython_package_dir(), u'config', u'profile', 'README') | |
|
220 | if not os.path.exists(readme) and os.path.exists(readme_src): | |
|
221 | shutil.copy(readme_src, readme) | |
|
222 | for d in ('extensions', 'nbextensions'): | |
|
223 | path = os.path.join(new, d) | |
|
224 | if not os.path.exists(path): | |
|
225 | try: | |
|
226 | os.mkdir(path) | |
|
227 | except OSError as e: | |
|
228 | if e.errno != errno.EEXIST: | |
|
229 | self.log.error("couldn't create path %s: %s", path, e) | |
|
220 | 230 | self.log.debug("IPYTHONDIR set to: %s" % new) |
|
221 | 231 | |
|
222 | 232 | def load_config_file(self, suppress_errors=True): |
General Comments 0
You need to be logged in to leave comments.
Login now