From fa94dc49e4b4956fc5ad39e521f4fe51b9dd679b Mon Sep 17 00:00:00 2001
From: Cristian C Lalescu <Cristian.Lalescu@ds.mpg.de>
Date: Thu, 10 Dec 2015 12:31:30 +0100
Subject: [PATCH] fix version problem

---
 bfps/__init__.py | 30 ++++++++++++++----------------
 setup.py         |  4 ++--
 2 files changed, 16 insertions(+), 18 deletions(-)

diff --git a/bfps/__init__.py b/bfps/__init__.py
index 248b5a75..799a0d12 100644
--- a/bfps/__init__.py
+++ b/bfps/__init__.py
@@ -28,23 +28,21 @@ import os
 import subprocess
 import pickle
 
-from pkg_resources import get_distribution, DistributionNotFound
+import pkg_resources
 
-try:
-    _dist = get_distribution('bfps')
-    # Normalize case for Windows systems
-    dist_loc = os.path.normcase(os.path.realpath(_dist.location))
-    here = os.path.normcase(__file__)
-    if not here.startswith(os.path.join(dist_loc, 'bfps')):
-        # not installed, but there is another version that *is*
-        header_dir = os.path.join(os.path.dirname(here), 'cpp')
-        lib_dir = os.path.dirname(here)
-        raise DistributionNotFound
-    header_dir = os.path.join(os.path.join(dist_loc, 'bfps'), 'cpp')
-    lib_dir = os.path.join(dist_loc, 'bfps')
-    __version__ = _dist.version
-except DistributionNotFound:
-    __version__ = ''
+__version__ = pkg_resources.require('bfps')[0].version
+
+_dist = pkg_resources.get_distribution('bfps')
+# Normalize case for Windows systems
+dist_loc = os.path.normcase(os.path.realpath(_dist.location))
+here = os.path.normcase(__file__)
+if not here.startswith(os.path.join(dist_loc, 'bfps')):
+    # not installed, but there is another version that *is*
+    header_dir = os.path.join(os.path.dirname(here), 'cpp')
+    lib_dir = os.path.dirname(here)
+    raise pkg_resources.DistributionNotFound
+header_dir = os.path.join(os.path.join(dist_loc, 'bfps'), 'cpp')
+lib_dir = os.path.join(dist_loc, 'bfps')
 
 install_info = pickle.load(
         open(os.path.join(os.path.dirname(here),
diff --git a/setup.py b/setup.py
index 0a3f45bc..52964a8d 100644
--- a/setup.py
+++ b/setup.py
@@ -130,6 +130,7 @@ class CustomBuild(DistutilsBuild):
         compile_bfps_library()
         DistutilsBuild.run(self)
 
+# this custom install leads to a broken installation. no idea why...
 class CustomInstall(DistutilsInstall):
     def run(self):
         compile_bfps_library()
@@ -141,8 +142,7 @@ setup(
         name = 'bfps',
         packages = ['bfps'],
         install_requires = ['numpy>=1.8', 'h5py>=2.2.1'],
-        cmdclass={'install' : CustomInstall,
-                  'build'   : CustomBuild},
+        cmdclass={'build' : CustomBuild},
         package_data = {'bfps': header_list + ['../machine_settings.py',
                                                'libbfps.a',
                                                'install_info.pickle']},
-- 
GitLab