From b3a144cf8ab0a6f52a6b5f53bbc861145e46acc8 Mon Sep 17 00:00:00 2001 From: Tom Close Date: Tue, 18 Oct 2016 11:30:34 +1100 Subject: [PATCH] touching up setup.py to install libninemlnrn --- AUTHORS | 4 +-- setup.py | 79 +++++++++++++------------------------------------------- 2 files changed, 20 insertions(+), 63 deletions(-) diff --git a/AUTHORS b/AUTHORS index b42e9eea..d8750ac6 100644 --- a/AUTHORS +++ b/AUTHORS @@ -1,7 +1,7 @@ The following people have contributed to PyPe9. Their affiliations at the time of the contributions are shown below. -* Thomas Close [1,2] -* Andrew Davison [3] +* Thomas G. Close [1,2] +* Andrew P. Davison [3] 1. Computational Neuroscience Unit, Okinawa Institute of Science and Technology (OIST), Onna-son, Okinawa, Japan 2. Monash Biomedical Imaging, Monash University, Clayton, Victoria, Australia diff --git a/setup.py b/setup.py index 9cfac5a3..9fef291b 100644 --- a/setup.py +++ b/setup.py @@ -20,61 +20,23 @@ packages = [p for p in find_packages() if p != 'test'] -# Attempt to find the prefix of the gsl and gslcblas libraries used by NEST - - # Check /usr and /usr/local to see if there is a version of libgsl and # libgslcblas there -system_gsl = set() -for system_path in ('/usr', join('/usr', 'local')): - system_libs = os.listdir(system_path) - if any(l.startswith('libgsl.') or l.startswith('libgslcblas.') - for l in system_libs): - system_gsl.add(system_path) - -# Check for the version of gsl linked to the pynestkernel -try: - # Import NEST with suppressed NEST splash - import nest - cwd = os.getcwd() - os.chdir(dirname(nest.__file__)) - if platform.platform().startswith('Darwin'): - ldd_cmd = 'otool -L' - else: - ldd_cmd = 'ldd' - ldd_out = sp.check_output('{} pynestkernel.so'.format(ldd_cmd), - shell=True) - nest_gsl = set(dirname(dirname(abspath(l.split()[0]))) + sep - for l in ldd_out.split('\n\t') if 'libgsl' in l) - assert nest_gsl, "NEST not linked to GSL? ldd output:\n{}".format(ldd_out) -except ImportError: - nest_gsl = set() # Assume they are already on system path - print ("WARNING, Could not import NEST to determine which gsl libraries it" - " uses") - -if system_gsl: - if nest_gsl and nest_gsl != system_gsl: - raise Exception( - "System GSL version found at '{}' is different from that linked " - "to NEST at '{}'. Please specify which version you would like to " - "use in setup.cfg in the include-dirs and link-dirs options under " - "[build_ext]".format("', '".join(nest_gsl), - "', '".join(system_gsl))) - else: - print ("Using system gsl version at '{}'" - .format("', '".join(system_gsl))) - gsl_prefixes = system_gsl -elif nest_gsl: - print ("Using gsl version linked to NEST at '{}'" - .format("', '".join(nest_gsl))) - gsl_prefixes = nest_gsl -else: - raise Exception( - "No version of GSL found in system paths or by inspecting libs linked" - "to NEST. Please install GNU Scientific Library if necessary and/or " - "specify its location in setup.cfg in both include-dirs and link-dirs " - "options of [build_ext]") +found_libgsl = False +found_libgslcblas = False +for pth in ('/usr', join('/usr', 'local')): + libs = os.listdir(pth) + if any(l.startswith('libgsl.') for l in libs): + found_libgsl = True + if any(l.startswith('libgslcblas.') for l in libs): + found_libgslcblas = True +#if not found_libgsl or not found_libgslcblas: +# raise Exception( +# "Could not find GNU Scientific Library on system paths or those " +# "defined in setup.cfg. Please ensure a recent version is installed " +# "and the path is appened to include-dirs and library-dirs in " +# "setup.cfg.") # Set up the required extension to handle random number generation using GSL # RNG in NEURON components @@ -82,24 +44,19 @@ sources=[os.path.join('neuron', 'cells', 'code_gen', 'libninemlnrn', 'nineml.cpp')], libraries=['m', 'gslcblas', 'gsl', 'c'], - language="c++", - extra_compile_args=[join('-I', p, 'include') - for p in gsl_prefixes], - extra_link_args=[join('-L', p, 'lib') - for p in gsl_prefixes]) + language="c++") setup( name="pype9", version="0.1a", package_data={package_name: package_data}, packages=packages, - author="Thomas G. Close and Andrew P. Davison", - # add your name here if you contribute to the code + author="The PyPe9 Team (see AUTHORS)", author_email="tom.g.close@gmail.com", description=("\"Python PipelinEs for 9ML (PyPe9)\" to simulate neuron and " - "neuron network models described in 9ML in the NEURON and " + "neuron network models described in 9ML with the NEURON and " "NEST simulators."), - long_description=open("README.rst").read(), + long_description=open(join(dirname(__file__), "README.rst")).read(), license="The MIT License (MIT)", keywords=("NineML pipeline computational neuroscience modeling " "interoperability XML 9ML neuron nest"),