##// END OF EJS Templates
Merge pull request #13345 from Carreau/no-sys-path-append...
Matthias Bussonnier -
r27377:a2ae81e8 merge
parent child Browse files
Show More
@@ -185,6 +185,17 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(
189 False,
190 """Should the IPython profile directory be added to sys path ?
191
192 This option was non-existing before IPython 8.0, and ipython_dir was added to
193 sys path to allow import of extensions present there. This was historical
194 baggage from when pip did not exist. This now default to false,
195 but can be set to true for legacy reasons.
196 """,
197 ).tag(config=True)
198
188 ipython_dir = Unicode(
199 ipython_dir = Unicode(
189 help="""
200 help="""
190 The name of the IPython directory. This directory is used for logging
201 The name of the IPython directory. This directory is used for logging
@@ -284,14 +295,17 b' class BaseIPythonApplication(Application):'
284 str_old = os.path.abspath(old)
295 str_old = os.path.abspath(old)
285 if str_old in sys.path:
296 if str_old in sys.path:
286 sys.path.remove(str_old)
297 sys.path.remove(str_old)
298 if self.add_ipython_dir_to_sys_path:
287 str_path = os.path.abspath(new)
299 str_path = os.path.abspath(new)
288 sys.path.append(str_path)
300 sys.path.append(str_path)
289 ensure_dir_exists(new)
301 ensure_dir_exists(new)
290 readme = os.path.join(new, 'README')
302 readme = os.path.join(new, "README")
291 readme_src = os.path.join(get_ipython_package_dir(), u'config', u'profile', 'README')
303 readme_src = os.path.join(
304 get_ipython_package_dir(), "config", "profile", "README"
305 )
292 if not os.path.exists(readme) and os.path.exists(readme_src):
306 if not os.path.exists(readme) and os.path.exists(readme_src):
293 shutil.copy(readme_src, readme)
307 shutil.copy(readme_src, readme)
294 for d in ('extensions', 'nbextensions'):
308 for d in ("extensions", "nbextensions"):
295 path = os.path.join(new, d)
309 path = os.path.join(new, d)
296 try:
310 try:
297 ensure_dir_exists(path)
311 ensure_dir_exists(path)
General Comments 0
You need to be logged in to leave comments. Login now