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