|
13 | 13 | # This enables setuptools to install wheel on-the-fly
|
14 | 14 | SETUP_REQUIRES += ['wheel'] if 'bdist_wheel' in sys.argv else []
|
15 | 15 |
|
16 |
| - |
17 |
| -VERSION = get_version(root='..', relative_to=__file__) |
| 16 | +try: |
| 17 | + VERSION = get_version(root='..', relative_to=__file__) |
| 18 | +except LookupError: # PY27 will not be able to build with a correct version, probably |
| 19 | + # Note that `python setup.py *` will work, but `pip install` generally won't |
| 20 | + VERSION = '99.99.99' |
18 | 21 |
|
19 | 22 |
|
20 | 23 | def update_version(target_file, version):
|
21 | 24 | with open(target_file) as fp:
|
22 | 25 | contents = fp.read()
|
23 |
| - updated = contents.replace('__version__ = "99.99.99"', '__version__ = "{%s}"' % version) |
| 26 | + updated = contents.replace('__version__ = "99.99.99"', '__version__ = "%s"' % version) |
24 | 27 | with open(target_file, 'w') as fp:
|
25 | 28 | fp.write(updated)
|
26 | 29 |
|
27 | 30 |
|
28 | 31 | class PatchVersionSdist(sdist):
|
29 | 32 | def make_release_tree(self, base_dir, files):
|
30 |
| - super().make_release_tree(base_dir, files) |
| 33 | + sdist.make_release_tree(self, base_dir, files) |
31 | 34 | target_file = base_dir + '/smriprep_docker.py'
|
32 | 35 | update_version(target_file, VERSION)
|
33 | 36 |
|
34 | 37 |
|
35 | 38 | class PatchVersionBuild(build_py):
|
36 | 39 | def run(self):
|
37 |
| - super().run() |
| 40 | + build_py.run(self) |
38 | 41 | target_file = self.build_lib + '/smriprep_docker.py'
|
39 | 42 | update_version(target_file, VERSION)
|
40 | 43 |
|
|
0 commit comments