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