Skip to content

Commit a200c32

Browse files
committed
Merge pull request #73 from mluessi/fix_import_surfer_setup
FIX: don't import surfer in setup.py
2 parents 7c1bcf4 + e9ee103 commit a200c32

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
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-
import surfer
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 = surfer.__version__
31+
VERSION = version
2432

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

0 commit comments

Comments
 (0)