Skip to content

Commit 7f8a555

Browse files
committed
Moved mkdir_p to config to avoid circular imports. still imported into filemanip because it is a file function
1 parent f258848 commit 7f8a555

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

nipype/utils/config.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@
1313
from json import load, dump
1414
import os
1515
import shutil
16+
import errno
1617
from StringIO import StringIO
1718
from warnings import warn
1819

1920
from ..external import portalocker
20-
from .filemanip import mkdir_p
2121

2222
# Get home directory in platform-agnostic way
2323
homedir = os.path.expanduser('~')
@@ -56,6 +56,17 @@
5656
interval = 1209600
5757
""" % (homedir, os.getcwd())
5858

59+
60+
def mkdir_p(path):
61+
try:
62+
os.makedirs(path)
63+
except OSError as exc:
64+
if exc.errno == errno.EEXIST and os.path.isdir(path):
65+
pass
66+
else:
67+
raise
68+
69+
5970
class NipypeConfig(object):
6071
"""Base nipype config class
6172
"""

nipype/utils/filemanip.py

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@
1313
import os
1414
import re
1515
import shutil
16-
import errno
1716

1817
import numpy as np
1918

2019
from ..interfaces.traits_extension import isdefined
2120
from .misc import is_container
21+
from .config import mkdir_p
2222

2323
from .. import logging, config
2424
fmlogger = logging.getLogger("filemanip")
@@ -431,13 +431,3 @@ def write_rst_dict(info, prefix=''):
431431
for key, value in sorted(info.items()):
432432
out.append(prefix + '* ' + key + ' : ' + str(value))
433433
return '\n'.join(out)+'\n\n'
434-
435-
436-
def mkdir_p(path):
437-
try:
438-
os.makedirs(path)
439-
except OSError as exc:
440-
if exc.errno == errno.EEXIST and os.path.isdir(path):
441-
pass
442-
else:
443-
raise

0 commit comments

Comments
 (0)