diff --git a/bfps/__init__.py b/bfps/__init__.py index 248b5a75570bdafb1dad2c57e571b6981abbd13e..799a0d124b3002a1ffe2f291e8ed5b32b968c906 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 0a3f45bc444cba247da79dde955e123565b5c9e2..52964a8dd58d43b2db6f122bdd186298c811b15d 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']},