From 4a54178ff8aefcd58c3206b752db8f155901e2cb Mon Sep 17 00:00:00 2001 From: Ricardo Silva Date: Tue, 6 Mar 2018 16:31:28 +0100 Subject: Make neuron package more generic (#7393) Make neuron package more generic * find the bin directory dynamically for use in run_env and spack_env * replace filter_compilers after install with filter_compiler_wrappers * update checksum for _current_ 7.5 version * make +python conflict with ~shared * prepend the architecture specific lib directory to the LD_LIBRARY_PATH Signed-off-by: Ricardo Silva --- var/spack/repos/builtin/packages/neuron/package.py | 75 +++++++++++----------- 1 file changed, 36 insertions(+), 39 deletions(-) (limited to 'var') diff --git a/var/spack/repos/builtin/packages/neuron/package.py b/var/spack/repos/builtin/packages/neuron/package.py index 245d2d2902..e3e97ed8e4 100644 --- a/var/spack/repos/builtin/packages/neuron/package.py +++ b/var/spack/repos/builtin/packages/neuron/package.py @@ -27,19 +27,20 @@ from spack import * class Neuron(Package): + """NEURON is a simulation environment for single and networks of neurons. - """NEURON is a simulation environment for modeling individual - and networks of neurons. NEURON models individual neurons via - the use of sections that are automatically subdivided into individual - compartments, instead of requiring the user to manually create - compartments. The primary scripting language is hoc but a Python - interface is also available.""" + NEURON is a simulation environment for modeling individual and networks of + neurons. NEURON models individual neurons via the use of sections that are + automatically subdivided into individual compartments, instead of + requiring the user to manually create compartments. The primary scripting + language is hoc but a Python interface is also available. + """ homepage = "https://www.neuron.yale.edu/" url = "http://www.neuron.yale.edu/ftp/neuron/versions/v7.5/nrn-7.5.tar.gz" github = "https://github.com/nrnhines/nrn" - version('7.5', '1641ae7a7cd02728e5ae4c8aa93b3749') + version('7.5', 'fb72c841374dfacbb6c2168ff57bfae9') version('7.4', '2c0bbee8a9e55d60fa26336f4ab7acbf') version('7.3', '993e539cb8bf102ca52e9fefd644ab61') version('7.2', '5486709b6366add932e3a6d141c4f7ad') @@ -64,6 +65,26 @@ class Neuron(Package): depends_on('python@2.6:', when='+python') depends_on('ncurses', when='~cross-compile') + conflicts('~shared', when='+python') + + filter_compiler_wrappers('*/bin/nrniv_makefile') + + def get_neuron_archdir(self): + """Determine the architecture-specific neuron base directory. + + Instead of recreating the logic of the neuron's configure + we dynamically find the architecture-specific directory by + looking for a specific binary. + """ + file_list = find(self.prefix, '*/bin/nrniv_makefile') + # check needed as when initially evaluated the prefix is empty + if file_list: + neuron_archdir = os.path.dirname(os.path.dirname(file_list[0])) + else: + neuron_archdir = self.prefix + + return neuron_archdir + def patch(self): # aclocal need complete include path (especially on os x) pkgconf_inc = '-I %s/share/aclocal/' % (self.spec['pkg-config'].prefix) @@ -90,18 +111,6 @@ class Neuron(Package): return options - def get_arch_dir(self): - if 'bgq' in self.spec.architecture: - arch = 'powerpc64' - elif 'cray' in self.spec.architecture: - arch = 'x86_64' - elif 'ppc64le' in self.spec.architecture: - arch = 'powerpc64le' - else: - arch = self.spec.architecture.target - - return arch - def get_python_options(self, spec): options = [] @@ -199,26 +208,14 @@ class Neuron(Package): make('VERBOSE=1') make('install') - @run_after('install') - def filter_compilers(self): - """run after install to avoid spack compiler wrappers - getting embded into nrnivmodl script""" - - arch = self.get_arch_dir() - nrnmakefile = join_path(self.prefix, arch, 'bin/nrniv_makefile') - - kwargs = { - 'backup': False, - 'string': True - } - - filter_file(env['CC'], self.compiler.cc, nrnmakefile, **kwargs) - filter_file(env['CXX'], self.compiler.cxx, nrnmakefile, **kwargs) - def setup_environment(self, spack_env, run_env): - arch = self.get_arch_dir() - run_env.prepend_path('PATH', join_path(self.prefix, arch, 'bin')) + neuron_archdir = self.get_neuron_archdir() + run_env.prepend_path('PATH', join_path(neuron_archdir, 'bin')) + run_env.prepend_path( + 'LD_LIBRARY_PATH', join_path(neuron_archdir, 'lib')) def setup_dependent_environment(self, spack_env, run_env, dependent_spec): - arch = self.get_arch_dir() - spack_env.prepend_path('PATH', join_path(self.prefix, arch, 'bin')) + neuron_archdir = self.get_neuron_archdir() + spack_env.prepend_path('PATH', join_path(neuron_archdir, 'bin')) + spack_env.prepend_path( + 'LD_LIBRARY_PATH', join_path(neuron_archdir, 'lib')) -- cgit v1.2.3-60-g2f50