##// 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 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 199 ipython_dir = Unicode(
189 200 help="""
190 201 The name of the IPython directory. This directory is used for logging
@@ -284,14 +295,17 b' class BaseIPythonApplication(Application):'
284 295 str_old = os.path.abspath(old)
285 296 if str_old in sys.path:
286 297 sys.path.remove(str_old)
298 if self.add_ipython_dir_to_sys_path:
287 299 str_path = os.path.abspath(new)
288 300 sys.path.append(str_path)
289 301 ensure_dir_exists(new)
290 readme = os.path.join(new, 'README')
291 readme_src = os.path.join(get_ipython_package_dir(), u'config', u'profile', 'README')
302 readme = os.path.join(new, "README")
303 readme_src = os.path.join(
304 get_ipython_package_dir(), "config", "profile", "README"
305 )
292 306 if not os.path.exists(readme) and os.path.exists(readme_src):
293 307 shutil.copy(readme_src, readme)
294 for d in ('extensions', 'nbextensions'):
308 for d in ("extensions", "nbextensions"):
295 309 path = os.path.join(new, d)
296 310 try:
297 311 ensure_dir_exists(path)
General Comments 0
You need to be logged in to leave comments. Login now