From 9bad8dead2ed3717308f401c7a4069819f9af9bc 2015-03-31 21:30:37 From: Thomas Kluyver Date: 2015-03-31 21:30:37 Subject: [PATCH] Remove checks for pre-0.11 config files --- diff --git a/IPython/terminal/ipapp.py b/IPython/terminal/ipapp.py index 7477498..adbace6 100755 --- a/IPython/terminal/ipapp.py +++ b/IPython/terminal/ipapp.py @@ -34,7 +34,7 @@ from IPython.core.shellapp import ( from IPython.extensions.storemagic import StoreMagics from IPython.terminal.interactiveshell import TerminalInteractiveShell from IPython.utils import warn -from IPython.utils.path import get_ipython_dir, check_for_old_config +from IPython.utils.path import get_ipython_dir from IPython.utils.traitlets import ( Bool, List, Dict, ) @@ -246,16 +246,12 @@ class TerminalIPythonApp(BaseIPythonApplication, InteractiveShellApp): # *do* autocreate requested profile, but don't create the config file. auto_create=Bool(True) # configurables - ignore_old_config=Bool(False, config=True, - help="Suppress warning messages about legacy config files" - ) quick = Bool(False, config=True, help="""Start IPython quickly by skipping the loading of config files.""" ) def _quick_changed(self, name, old, new): if new: self.load_config_file = lambda *a, **kw: None - self.ignore_old_config=True display_banner = Bool(True, config=True, help="Whether to display a banner upon starting IPython." @@ -307,8 +303,6 @@ class TerminalIPythonApp(BaseIPythonApplication, InteractiveShellApp): if self.subapp is not None: # don't bother initializing further, starting subapp return - if not self.ignore_old_config: - check_for_old_config(self.ipython_dir) # print self.extra_args if self.extra_args and not self.something_to_run: self.file_to_run = self.extra_args[0] diff --git a/IPython/utils/path.py b/IPython/utils/path.py index 1802173..5ad52e3 100644 --- a/IPython/utils/path.py +++ b/IPython/utils/path.py @@ -21,6 +21,8 @@ from IPython.testing.skipdoctest import skip_doctest from IPython.utils.process import system from IPython.utils.importstring import import_item from IPython.utils import py3compat +from IPython.utils.decorators import undoc + #----------------------------------------------------------------------------- # Code #----------------------------------------------------------------------------- @@ -443,51 +445,14 @@ def target_update(target,deps,cmd): if target_outdated(target,deps): system(cmd) +@undoc def filehash(path): """Make an MD5 hash of a file, ignoring any differences in line ending characters.""" + warn("filehash() is deprecated") with open(path, "rU") as f: return md5(py3compat.str_to_bytes(f.read())).hexdigest() -# If the config is unmodified from the default, we'll just delete it. -# These are consistent for 0.10.x, thankfully. We're not going to worry about -# older versions. -old_config_md5 = {'ipy_user_conf.py': 'fc108bedff4b9a00f91fa0a5999140d3', - 'ipythonrc': '12a68954f3403eea2eec09dc8fe5a9b5'} - -def check_for_old_config(ipython_dir=None): - """Check for old config files, and present a warning if they exist. - - A link to the docs of the new config is included in the message. - - This should mitigate confusion with the transition to the new - config system in 0.11. - """ - if ipython_dir is None: - ipython_dir = get_ipython_dir() - - old_configs = ['ipy_user_conf.py', 'ipythonrc', 'ipython_config.py'] - warned = False - for cfg in old_configs: - f = os.path.join(ipython_dir, cfg) - if os.path.exists(f): - if filehash(f) == old_config_md5.get(cfg, ''): - os.unlink(f) - else: - warn("Found old IPython config file {!r} (modified by user)".format(f)) - warned = True - - if warned: - warn(""" - The IPython configuration system has changed as of 0.11, and these files will - be ignored. See http://ipython.github.com/ipython-doc/dev/config for details - of the new config system. - To start configuring IPython, do `ipython profile create`, and edit - `ipython_config.py` in /profile_default. - If you need to leave the old config files in place for an older version of - IPython and want to suppress this warning message, set - `c.InteractiveShellApp.ignore_old_config=True` in the new config.""") - def get_security_file(filename, profile='default'): """Return the absolute path of a security file given by filename and profile