Skip to content

using RawConfigParser instead of ConfigParser (closes #2541) #2542

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Apr 25, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions nipype/pkg_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,7 @@ def pkg_commit_hash(pkg_path):
pth = os.path.join(pkg_path, COMMIT_INFO_FNAME)
if not os.path.isfile(pth):
raise IOError('Missing commit info file %s' % pth)
if PY3:
cfg_parser = configparser.RawConfigParser()
else:
cfg_parser = configparser.ConfigParser()
cfg_parser = configparser.RawConfigParser()
with open(pth, encoding='utf-8') as fp:
cfg_parser.readfp(fp)
archive_subst = cfg_parser.get('commit hash', 'archive_subst_hash')
Expand Down
9 changes: 7 additions & 2 deletions nipype/tests/test_nipype.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
from .. import get_info
from ..info import get_nipype_gitversion
import pytest


def test_nipype_info():
Expand All @@ -10,5 +12,8 @@ def test_nipype_info():
assert exception_not_raised


# def test_fail_always():
# assert False
@pytest.mark.skipif(not get_nipype_gitversion(),
reason="not able to get version from get_nipype_gitversion")
def test_git_hash():
# removing the first "g" from gitversion
get_nipype_gitversion()[1:] == get_info()['commit_hash']
5 changes: 1 addition & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,7 @@ def run(self):
repo_commit = repo_commit.decode()

# We write the installation commit even if it's empty
if PY3:
cfg_parser = configparser.RawConfigParser()
else:
cfg_parser = configparser.ConfigParser()
cfg_parser = configparser.RawConfigParser()
cfg_parser.read(pjoin('nipype', 'COMMIT_INFO.txt'))
cfg_parser.set('commit hash', 'install_hash', repo_commit.strip())
out_pth = pjoin(self.build_lib, 'nipype', 'COMMIT_INFO.txt')
Expand Down