##// END OF EJS Templates
Update IPython.utils.path to use stdlib warnings module.
Thomas Kluyver -
Show More
@@ -17,10 +17,10 Utilities for path handling.
17 17 import os
18 18 import sys
19 19 import tempfile
20 import warnings
20 21 from hashlib import md5
21 22
22 23 import IPython
23 from IPython.utils import warn
24 24 from IPython.utils.process import system
25 25 from IPython.utils.importstring import import_item
26 26 from IPython.utils import py3compat
@@ -338,14 +338,14 def get_ipython_dir():
338 338
339 339 if os.path.exists(ipdir) and not _writable_dir(ipdir):
340 340 # ipdir exists, but is not writable
341 warn.warn("IPython dir '%s' is not a writable location,"
341 warnings.warn("IPython dir '%s' is not a writable location,"
342 342 " using a temp directory."%ipdir)
343 343 ipdir = tempfile.mkdtemp()
344 344 elif not os.path.exists(ipdir):
345 345 parent = ipdir.rsplit(os.path.sep, 1)[0]
346 346 if not _writable_dir(parent):
347 347 # ipdir does not exist and parent isn't writable
348 warn.warn("IPython parent '%s' is not a writable location,"
348 warnings.warn("IPython parent '%s' is not a writable location,"
349 349 " using a temp directory."%parent)
350 350 ipdir = tempfile.mkdtemp()
351 351
@@ -462,11 +462,11 def check_for_old_config(ipython_dir=None):
462 462 if filehash(f) == old_config_md5.get(cfg, ''):
463 463 os.unlink(f)
464 464 else:
465 warn.warn("Found old IPython config file %r (modified by user)"%f)
465 warnings.warn("Found old IPython config file %r (modified by user)"%f)
466 466 warned = True
467 467
468 468 if warned:
469 warn.info("""
469 warnings.warn("""
470 470 The IPython configuration system has changed as of 0.11, and these files will
471 471 be ignored. See http://ipython.github.com/ipython-doc/dev/config for details
472 472 of the new config system.
@@ -404,7 +404,7 def test_not_writable_ipdir():
404 404 ipdir = os.path.join(tmpdir, '.ipython')
405 405 os.mkdir(ipdir)
406 406 os.chmod(ipdir, 600)
407 with AssertPrints('WARNING', channel='stderr'):
407 with AssertPrints('is not a writable location', channel='stderr'):
408 408 ipdir = path.get_ipython_dir()
409 409 env.pop('IPYTHON_DIR', None)
410 410
General Comments 0
You need to be logged in to leave comments. Login now