diff options
author | Mario Mulansky <mario.mulansky@gmx.net> | 2015-05-18 15:28:46 +0200 |
---|---|---|
committer | Mario Mulansky <mario.mulansky@gmx.net> | 2015-05-18 15:28:46 +0200 |
commit | 2b957ac5d7c964b6fe0e99bb078a396732331869 (patch) | |
tree | fc583b16d030b6ba67cf09895fd269bd297ad660 /pyspike | |
parent | 81fc2c20e7360714f218e9bba729ec4387f59aef (diff) | |
parent | a718911ba2aac9302465c0522cc18b4470b99f77 (diff) |
Merge branch 'master' into develop
Conflicts:
setup.py
Diffstat (limited to 'pyspike')
-rw-r--r-- | pyspike/__init__.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/pyspike/__init__.py b/pyspike/__init__.py index a5f9f0a..3e836bd 100644 --- a/pyspike/__init__.py +++ b/pyspike/__init__.py @@ -23,3 +23,22 @@ from psth import psth from spikes import load_spike_trains_from_txt, spike_train_from_string, \ merge_spike_trains, generate_poisson_spikes + + +# define the __version__ following +# http://stackoverflow.com/questions/17583443 +from pkg_resources import get_distribution, DistributionNotFound +import os.path + +try: + _dist = get_distribution('pyspike') + # Normalize case for Windows systems + dist_loc = os.path.normcase(_dist.location) + here = os.path.normcase(__file__) + if not here.startswith(os.path.join(dist_loc, 'pyspike')): + # not installed, but there is another version that *is* + raise DistributionNotFound +except DistributionNotFound: + __version__ = 'Please install this project with setup.py' +else: + __version__ = _dist.version |