Skip to content

Commit 2c3b7b0

Browse files
committed
fix python 3 install
1 parent 1b4d4a3 commit 2c3b7b0

File tree

1 file changed

+25
-21
lines changed

1 file changed

+25
-21
lines changed

setup.py

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,6 @@ def main():
8989

9090
thispath, _ = os.path.split(__file__)
9191

92-
# Get version and release info, which is all stored in nipype/info.py
93-
ver_file = os.path.join(thispath, 'nipype', 'info.py')
94-
exec(open(ver_file).read(), locals())
95-
9692
testdatafiles = [pjoin('testing', 'data', val)
9793
for val in os.listdir(pjoin(thispath, 'nipype', 'testing', 'data'))
9894
if not os.path.isdir(pjoin(thispath, 'nipype', 'testing', 'data', val))]
@@ -109,23 +105,31 @@ def main():
109105
pjoin('interfaces', 'tests', 'use_resources'),
110106
]
111107

108+
# Python 3: use a locals dictionary
109+
# http://stackoverflow.com/a/1463370/6820620
110+
ldict = locals()
111+
# Get version and release info, which is all stored in nipype/info.py
112+
ver_file = os.path.join(thispath, 'nipype', 'info.py')
113+
with open(ver_file) as infofile:
114+
exec(infofile.read(), globals(), ldict)
115+
112116
setup(
113-
name=NAME,
114-
maintainer=MAINTAINER,
115-
maintainer_email=MAINTAINER_EMAIL,
116-
description=DESCRIPTION,
117-
long_description=LONG_DESCRIPTION,
118-
url=URL,
119-
download_url=DOWNLOAD_URL,
120-
license=LICENSE,
121-
classifiers=CLASSIFIERS,
122-
author=AUTHOR,
123-
author_email=AUTHOR_EMAIL,
124-
platforms=PLATFORMS,
125-
version=VERSION,
126-
install_requires=REQUIRES,
117+
name=ldict['NAME'],
118+
maintainer=ldict['MAINTAINER'],
119+
maintainer_email=ldict['MAINTAINER_EMAIL'],
120+
description=ldict['DESCRIPTION'],
121+
long_description=ldict['LONG_DESCRIPTION'],
122+
url=ldict['URL'],
123+
download_url=ldict['DOWNLOAD_URL'],
124+
license=ldict['LICENSE'],
125+
classifiers=ldict['CLASSIFIERS'],
126+
author=ldict['AUTHOR'],
127+
author_email=ldict['AUTHOR_EMAIL'],
128+
platforms=ldict['PLATFORMS'],
129+
version=ldict['VERSION'],
130+
install_requires=ldict['REQUIRES'],
127131
setup_requires=['configparser'],
128-
provides=PROVIDES,
132+
provides=ldict['PROVIDES'],
129133
packages=[
130134
'nipype',
131135
'nipype.algorithms',
@@ -250,10 +254,10 @@ def main():
250254
package_data={'nipype': testdatafiles},
251255
scripts=glob('bin/*'),
252256
cmdclass={ 'build_py': BuildWithCommitInfoCommand },
253-
tests_require=TESTS_REQUIRES,
257+
tests_require=ldict['TESTS_REQUIRES'],
254258
test_suite='nose.collector',
255259
zip_safe=False,
256-
extras_require=EXTRA_REQUIRES
260+
extras_require=ldict['EXTRA_REQUIRES']
257261
)
258262

259263
if __name__ == "__main__":

0 commit comments

Comments
 (0)