|
37 | 37 | ''' Distutils / setuptools helpers from nibabel.nisext'''
|
38 | 38 |
|
39 | 39 | import os
|
40 |
| -from os.path import join as pjoin, split as psplit, splitext |
| 40 | +from os.path import join as pjoin |
41 | 41 | import sys
|
42 |
| -from configparser import ConfigParser |
| 42 | +PY3 = sys.version_info[0] >= 3 |
| 43 | +if PY3: |
| 44 | + string_types = str, |
| 45 | +else: |
| 46 | + string_types = basestring, |
| 47 | +try: |
| 48 | + from ConfigParser import ConfigParser |
| 49 | +except ImportError: |
| 50 | + from configparser import ConfigParser |
43 | 51 |
|
44 | 52 | from distutils.version import LooseVersion
|
45 | 53 | from distutils.command.build_py import build_py
|
@@ -108,7 +116,7 @@ def _add_append_key(in_dict, key, value):
|
108 | 116 | # Append value to in_dict[key] list
|
109 | 117 | if key not in in_dict:
|
110 | 118 | in_dict[key] = []
|
111 |
| - elif isinstance(in_dict[key], str): |
| 119 | + elif isinstance(in_dict[key], string_types): |
112 | 120 | in_dict[key] = [in_dict[key]]
|
113 | 121 | in_dict[key].append(value)
|
114 | 122 |
|
@@ -205,7 +213,7 @@ def version_getter(pkg_name):
|
205 | 213 | + msgs['opt suffix'])
|
206 | 214 | return
|
207 | 215 | # setuptools mode
|
208 |
| - if optional_tf and not isinstance(optional, str): |
| 216 | + if optional_tf and not isinstance(optional, string_types): |
209 | 217 | raise RuntimeError('Not-False optional arg should be string')
|
210 | 218 | dependency = pkg_name
|
211 | 219 | if version:
|
@@ -286,7 +294,7 @@ def main(**extra_args):
|
286 | 294 | version=VERSION,
|
287 | 295 | install_requires=REQUIRES,
|
288 | 296 | provides=PROVIDES,
|
289 |
| - packages = [ 'nipype', |
| 297 | + packages = [ 'nipype', |
290 | 298 | 'nipype.algorithms',
|
291 | 299 | 'nipype.algorithms.tests',
|
292 | 300 | 'nipype.caching',
|
|
0 commit comments