Show More
@@ -185,6 +185,15 b' class BaseIPythonApplication(Application):' | |||||
185 | get_ipython_package_dir(), u'config', u'profile', change['new'] |
|
185 | get_ipython_package_dir(), u'config', u'profile', change['new'] | |
186 | ) |
|
186 | ) | |
187 |
|
187 | |||
|
188 | add_ipython_dir_to_sys_path = Bool(False, | |||
|
189 | """Should the IPython profile directory be added to sys path ? | |||
|
190 | ||||
|
191 | This option was non-existing before IPython 8.0, and ipython_dir was added to | |||
|
192 | sys path to allow import of extensions present there. This was historical | |||
|
193 | baggage from when pip did not exist. This now default to false, | |||
|
194 | but can bet to true for legacy reasons | |||
|
195 | """).tag(config=True) | |||
|
196 | ||||
188 | ipython_dir = Unicode( |
|
197 | ipython_dir = Unicode( | |
189 | help=""" |
|
198 | help=""" | |
190 | The name of the IPython directory. This directory is used for logging |
|
199 | The name of the IPython directory. This directory is used for logging | |
@@ -294,21 +303,22 b' class BaseIPythonApplication(Application):' | |||||
294 | str_old = os.path.abspath(old) |
|
303 | str_old = os.path.abspath(old) | |
295 | if str_old in sys.path: |
|
304 | if str_old in sys.path: | |
296 | sys.path.remove(str_old) |
|
305 | sys.path.remove(str_old) | |
297 | str_path = os.path.abspath(new) |
|
306 | if self.add_ipython_dir_to_sys_path: | |
298 |
|
|
307 | str_path = os.path.abspath(new) | |
299 | ensure_dir_exists(new) |
|
308 | #sys.path.append(str_path) | |
300 | readme = os.path.join(new, 'README') |
|
309 | ensure_dir_exists(new) | |
301 | readme_src = os.path.join(get_ipython_package_dir(), u'config', u'profile', 'README') |
|
310 | readme = os.path.join(new, 'README') | |
302 | if not os.path.exists(readme) and os.path.exists(readme_src): |
|
311 | readme_src = os.path.join(get_ipython_package_dir(), u'config', u'profile', 'README') | |
303 | shutil.copy(readme_src, readme) |
|
312 | if not os.path.exists(readme) and os.path.exists(readme_src): | |
304 | for d in ('extensions', 'nbextensions'): |
|
313 | shutil.copy(readme_src, readme) | |
305 | path = os.path.join(new, d) |
|
314 | for d in ('extensions', 'nbextensions'): | |
306 | try: |
|
315 | path = os.path.join(new, d) | |
307 | ensure_dir_exists(path) |
|
316 | try: | |
308 | except OSError as e: |
|
317 | ensure_dir_exists(path) | |
309 | # this will not be EEXIST |
|
318 | except OSError as e: | |
310 | self.log.error("couldn't create path %s: %s", path, e) |
|
319 | # this will not be EEXIST | |
311 | self.log.debug("IPYTHONDIR set to: %s" % new) |
|
320 | self.log.error("couldn't create path %s: %s", path, e) | |
|
321 | self.log.debug("IPYTHONDIR set to: %s" % new) | |||
312 |
|
322 | |||
313 | def load_config_file(self, suppress_errors=IPYTHON_SUPPRESS_CONFIG_ERRORS): |
|
323 | def load_config_file(self, suppress_errors=IPYTHON_SUPPRESS_CONFIG_ERRORS): | |
314 | """Load the config file. |
|
324 | """Load the config file. |
General Comments 0
You need to be logged in to leave comments.
Login now