##// END OF EJS Templates
update to warnings
jgors -
Show More
@@ -12,9 +12,9 b' import errno'
12 12 import shutil
13 13 import random
14 14 import tempfile
15 import warnings
16 from hashlib import md5
17 15 import glob
16 from warnings import warn
17 from hashlib import md5
18 18
19 19 import IPython
20 20 from IPython.testing.skipdoctest import skip_doctest
@@ -271,8 +271,8 b' def get_ipython_dir():'
271 271
272 272 # import pdb; pdb.set_trace() # dbg
273 273 if 'IPYTHON_DIR' in env:
274 warnings.warn('The environment variable IPYTHON_DIR is deprecated. '
275 'Please use IPYTHONDIR instead.')
274 warn('The environment variable IPYTHON_DIR is deprecated. '
275 'Please use IPYTHONDIR instead.')
276 276 ipdir = env.get('IPYTHONDIR', env.get('IPYTHON_DIR', None))
277 277 if ipdir is None:
278 278 # not set explicitly, use ~/.ipython
@@ -285,28 +285,28 b' def get_ipython_dir():'
285 285 if _writable_dir(xdg_ipdir):
286 286 cu = compress_user
287 287 if os.path.exists(ipdir):
288 warnings.warn(('Ignoring {0} in favour of {1}. Remove {0} '
289 'to get rid of this message').format(cu(xdg_ipdir), cu(ipdir)))
288 warn(('Ignoring {0} in favour of {1}. Remove {0} to '
289 'get rid of this message').format(cu(xdg_ipdir), cu(ipdir)))
290 290 elif os.path.islink(xdg_ipdir):
291 warnings.warn(('{0} is deprecated. Move link to {1} '
292 'to get rid of this message').format(cu(xdg_ipdir), cu(ipdir)))
291 warn(('{0} is deprecated. Move link to {1} to '
292 'get rid of this message').format(cu(xdg_ipdir), cu(ipdir)))
293 293 else:
294 warnings.warn('Moving {0} to {1}'.format(cu(xdg_ipdir), cu(ipdir)))
294 warn('Moving {0} to {1}'.format(cu(xdg_ipdir), cu(ipdir)))
295 295 shutil.move(xdg_ipdir, ipdir)
296 296
297 297 ipdir = os.path.normpath(os.path.expanduser(ipdir))
298 298
299 299 if os.path.exists(ipdir) and not _writable_dir(ipdir):
300 300 # ipdir exists, but is not writable
301 warnings.warn("IPython dir '%s' is not a writable location,"
302 " using a temp directory."%ipdir)
301 warn("IPython dir '{0}' is not a writable location,"
302 " using a temp directory.".format(ipdir))
303 303 ipdir = tempfile.mkdtemp()
304 304 elif not os.path.exists(ipdir):
305 305 parent = os.path.dirname(ipdir)
306 306 if not _writable_dir(parent):
307 307 # ipdir does not exist and parent isn't writable
308 warnings.warn("IPython parent '%s' is not a writable location,"
309 " using a temp directory."%parent)
308 warn("IPython parent '{0}' is not a writable location,"
309 " using a temp directory.".format(parent))
310 310 ipdir = tempfile.mkdtemp()
311 311
312 312 return py3compat.cast_unicode(ipdir, fs_encoding)
@@ -473,11 +473,11 b' def check_for_old_config(ipython_dir=None):'
473 473 if filehash(f) == old_config_md5.get(cfg, ''):
474 474 os.unlink(f)
475 475 else:
476 warnings.warn("Found old IPython config file %r (modified by user)"%f)
476 warn("Found old IPython config file {0} (modified by user)".format(f))
477 477 warned = True
478 478
479 479 if warned:
480 warnings.warn("""
480 warn("""
481 481 The IPython configuration system has changed as of 0.11, and these files will
482 482 be ignored. See http://ipython.github.com/ipython-doc/dev/config for details
483 483 of the new config system.
General Comments 0
You need to be logged in to leave comments. Login now