Skip to content

Commit

Permalink
Merge pull request nipy#342 from satra/fix/config
Browse files Browse the repository at this point in the history
fix: added warning when old and new config are present
  • Loading branch information
satra committed Mar 20, 2012
2 parents d254cb5 + b1f72f1 commit 72aa698
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions nipype/utils/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,18 @@ def __init__(self, *args, **kwargs):
new_config_file = os.path.join(config_dir, 'nipype.cfg')
# To be deprecated in two releases
if os.path.exists(old_config_file):
warn("Moving old config file from: %s to %s" % (old_config_file,
new_config_file))
shutil.move(old_config_file, new_config_file)
if os.path.exists(new_config_file):
msg=("Detected presence of both old (%s, used by versions "
"< 0.5.2) and new (%s) config files. This version will "
"proceed with the new one. We advise to merge settings "
"and remove old config file if you are not planning to "
"use previous releases of nipype.") % (old_config_file,
new_config_file)
warn(msg)
else:
warn("Moving old config file from: %s to %s" % (old_config_file,
new_config_file))
shutil.move(old_config_file, new_config_file)
self.data_file = os.path.join(config_dir, 'nipype.json')
self._config.readfp(StringIO(default_cfg))
self._config.read([new_config_file, old_config_file, 'nipype.cfg'])
Expand Down

0 comments on commit 72aa698

Please sign in to comment.