Show More
@@ -34,7 +34,7 b' from IPython.core.shellapp import (' | |||
|
34 | 34 | from IPython.extensions.storemagic import StoreMagics |
|
35 | 35 | from IPython.terminal.interactiveshell import TerminalInteractiveShell |
|
36 | 36 | from IPython.utils import warn |
|
37 |
from IPython.utils.path import get_ipython_dir |
|
|
37 | from IPython.utils.path import get_ipython_dir | |
|
38 | 38 | from IPython.utils.traitlets import ( |
|
39 | 39 | Bool, List, Dict, |
|
40 | 40 | ) |
@@ -246,16 +246,12 b' class TerminalIPythonApp(BaseIPythonApplication, InteractiveShellApp):' | |||
|
246 | 246 | # *do* autocreate requested profile, but don't create the config file. |
|
247 | 247 | auto_create=Bool(True) |
|
248 | 248 | # configurables |
|
249 | ignore_old_config=Bool(False, config=True, | |
|
250 | help="Suppress warning messages about legacy config files" | |
|
251 | ) | |
|
252 | 249 | quick = Bool(False, config=True, |
|
253 | 250 | help="""Start IPython quickly by skipping the loading of config files.""" |
|
254 | 251 | ) |
|
255 | 252 | def _quick_changed(self, name, old, new): |
|
256 | 253 | if new: |
|
257 | 254 | self.load_config_file = lambda *a, **kw: None |
|
258 | self.ignore_old_config=True | |
|
259 | 255 | |
|
260 | 256 | display_banner = Bool(True, config=True, |
|
261 | 257 | help="Whether to display a banner upon starting IPython." |
@@ -307,8 +303,6 b' class TerminalIPythonApp(BaseIPythonApplication, InteractiveShellApp):' | |||
|
307 | 303 | if self.subapp is not None: |
|
308 | 304 | # don't bother initializing further, starting subapp |
|
309 | 305 | return |
|
310 | if not self.ignore_old_config: | |
|
311 | check_for_old_config(self.ipython_dir) | |
|
312 | 306 | # print self.extra_args |
|
313 | 307 | if self.extra_args and not self.something_to_run: |
|
314 | 308 | self.file_to_run = self.extra_args[0] |
@@ -21,6 +21,8 b' from IPython.testing.skipdoctest import skip_doctest' | |||
|
21 | 21 | from IPython.utils.process import system |
|
22 | 22 | from IPython.utils.importstring import import_item |
|
23 | 23 | from IPython.utils import py3compat |
|
24 | from IPython.utils.decorators import undoc | |
|
25 | ||
|
24 | 26 | #----------------------------------------------------------------------------- |
|
25 | 27 | # Code |
|
26 | 28 | #----------------------------------------------------------------------------- |
@@ -443,51 +445,14 b' def target_update(target,deps,cmd):' | |||
|
443 | 445 | if target_outdated(target,deps): |
|
444 | 446 | system(cmd) |
|
445 | 447 | |
|
448 | @undoc | |
|
446 | 449 | def filehash(path): |
|
447 | 450 | """Make an MD5 hash of a file, ignoring any differences in line |
|
448 | 451 | ending characters.""" |
|
452 | warn("filehash() is deprecated") | |
|
449 | 453 | with open(path, "rU") as f: |
|
450 | 454 | return md5(py3compat.str_to_bytes(f.read())).hexdigest() |
|
451 | 455 | |
|
452 | # If the config is unmodified from the default, we'll just delete it. | |
|
453 | # These are consistent for 0.10.x, thankfully. We're not going to worry about | |
|
454 | # older versions. | |
|
455 | old_config_md5 = {'ipy_user_conf.py': 'fc108bedff4b9a00f91fa0a5999140d3', | |
|
456 | 'ipythonrc': '12a68954f3403eea2eec09dc8fe5a9b5'} | |
|
457 | ||
|
458 | def check_for_old_config(ipython_dir=None): | |
|
459 | """Check for old config files, and present a warning if they exist. | |
|
460 | ||
|
461 | A link to the docs of the new config is included in the message. | |
|
462 | ||
|
463 | This should mitigate confusion with the transition to the new | |
|
464 | config system in 0.11. | |
|
465 | """ | |
|
466 | if ipython_dir is None: | |
|
467 | ipython_dir = get_ipython_dir() | |
|
468 | ||
|
469 | old_configs = ['ipy_user_conf.py', 'ipythonrc', 'ipython_config.py'] | |
|
470 | warned = False | |
|
471 | for cfg in old_configs: | |
|
472 | f = os.path.join(ipython_dir, cfg) | |
|
473 | if os.path.exists(f): | |
|
474 | if filehash(f) == old_config_md5.get(cfg, ''): | |
|
475 | os.unlink(f) | |
|
476 | else: | |
|
477 | warn("Found old IPython config file {!r} (modified by user)".format(f)) | |
|
478 | warned = True | |
|
479 | ||
|
480 | if warned: | |
|
481 | warn(""" | |
|
482 | The IPython configuration system has changed as of 0.11, and these files will | |
|
483 | be ignored. See http://ipython.github.com/ipython-doc/dev/config for details | |
|
484 | of the new config system. | |
|
485 | To start configuring IPython, do `ipython profile create`, and edit | |
|
486 | `ipython_config.py` in <ipython_dir>/profile_default. | |
|
487 | If you need to leave the old config files in place for an older version of | |
|
488 | IPython and want to suppress this warning message, set | |
|
489 | `c.InteractiveShellApp.ignore_old_config=True` in the new config.""") | |
|
490 | ||
|
491 | 456 | def get_security_file(filename, profile='default'): |
|
492 | 457 | """Return the absolute path of a security file given by filename and profile |
|
493 | 458 |
General Comments 0
You need to be logged in to leave comments.
Login now