Show More
@@ -273,7 +273,6 b' def get_ipython_dir():' | |||||
273 |
|
273 | |||
274 |
|
274 | |||
275 | ipdir_def = '.ipython' |
|
275 | ipdir_def = '.ipython' | |
276 | xdg_def = 'ipython' |
|
|||
277 |
|
276 | |||
278 | home_dir = get_home_dir() |
|
277 | home_dir = get_home_dir() | |
279 | xdg_dir = get_xdg_dir() |
|
278 | xdg_dir = get_xdg_dir() | |
@@ -284,20 +283,21 b' def get_ipython_dir():' | |||||
284 | 'Please use IPYTHONDIR instead.') |
|
283 | 'Please use IPYTHONDIR instead.') | |
285 | ipdir = env.get('IPYTHONDIR', env.get('IPYTHON_DIR', None)) |
|
284 | ipdir = env.get('IPYTHONDIR', env.get('IPYTHON_DIR', None)) | |
286 | if ipdir is None: |
|
285 | if ipdir is None: | |
287 |
# not set explicitly, use |
|
286 | # not set explicitly, use ~/.ipython | |
288 |
|
|
287 | ipdir = pjoin(home_dir, ipdir_def) | |
289 | if xdg_dir: |
|
288 | if xdg_dir: | |
290 | # use XDG, as long as the user isn't already |
|
289 | # Several IPython versions (up to 1.x) defaulted to .config/ipython | |
291 | # using $HOME/.ipython and *not* XDG/ipython |
|
290 | # on Linux. We have decided to go back to using .ipython everywhere | |
292 |
|
291 | xdg_ipdir = pjoin(xdg_dir, 'ipython') | ||
293 | xdg_ipdir = pjoin(xdg_dir, xdg_def) |
|
292 | ||
294 |
|
293 | if _writable_dir(xdg_ipdir): | ||
295 | if _writable_dir(xdg_ipdir) or not _writable_dir(home_ipdir): |
|
294 | cu = compress_user | |
296 |
ipdir |
|
295 | if os.path.exists(ipdir): | |
297 |
|
296 | warnings.warn(('Ignoring {0} in favour of {1}. Remove {0} ' | ||
298 | if ipdir is None: |
|
297 | 'to get rid of this message').format(cu(xdg_ipdir), cu(ipdir))) | |
299 |
|
|
298 | else: | |
300 | ipdir = home_ipdir |
|
299 | warnings.warn('Moving {0} to {1}'.format(cu(xdg_ipdir), cu(ipdir))) | |
|
300 | os.rename(xdg_ipdir, ipdir) | |||
301 |
|
301 | |||
302 | ipdir = os.path.normpath(os.path.expanduser(ipdir)) |
|
302 | ipdir = os.path.normpath(os.path.expanduser(ipdir)) | |
303 |
|
303 |
General Comments 0
You need to be logged in to leave comments.
Login now