Skip to content

Commit e9ee103

Browse files
author
Martin Luessi
committed
read version from __init__.py
1 parent 70ef6cc commit e9ee103

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

setup.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,15 @@
1010
# deal with MPL sandbox violations during easy_install
1111
os.environ['MPLCONFIGDIR'] = '.'
1212

13-
from surfer.__version__ import __version__
13+
# get the version, don't import surfer here so setup works on headless systems
14+
version = None
15+
with open(os.path.join('surfer', '__init__.py'), 'r') as fid:
16+
for line in (line.strip() for line in fid):
17+
if line.startswith('__version__'):
18+
version = line.split('=')[1].strip().strip('"')
19+
break
20+
if version is None:
21+
raise RuntimeError('Could not determine version')
1422

1523
DISTNAME = 'pysurfer'
1624
DESCRIPTION = descr
@@ -20,7 +28,7 @@
2028
URL = 'http://pysurfer.github.com'
2129
LICENSE = 'BSD (3-clause)'
2230
DOWNLOAD_URL = 'https://github.com/nipy/PySurfer'
23-
VERSION = __version__
31+
VERSION = version
2432

2533
import setuptools # we are using a setuptools namespace
2634
from numpy.distutils.core import setup

surfer/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
from viz import Brain, TimeViewer
33
from utils import verbose, set_log_level, set_log_file
44

5-
from __version__ import __version__
5+
__version__ = "0.5.dev"
66

77
set_log_level()

surfer/__version__.py

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)