-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
32 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
# SPDX-License-Identifier: (Apache-2.0 OR MIT) | ||
|
||
from spack import * | ||
import glob | ||
|
||
|
||
class Genn(PythonPackage): | ||
|
@@ -16,23 +17,30 @@ class Genn(PythonPackage): | |
version('4.6.0', sha256='5e5ca94fd3a56b5b963a4911ea1b2130df6fa7dcdde3b025bd8cb85d4c2d3236') | ||
|
||
conflicts('%gcc@:4.9.3') | ||
depends_on('gmake', type='build') | ||
depends_on('gmake', type='build') | ||
depends_on('googletest', type=('build', 'run', 'test')) | ||
depends_on('lcov', type=('build', 'run', 'test')) | ||
|
||
variant('cuda', default=True, description='Enable CUDA support') | ||
depends_on('cuda', when='+cuda') | ||
|
||
variant('python', default=True, description='Enable PyGeNN') | ||
extends('python', when='+python') | ||
depends_on('[email protected]:', when='+python') | ||
depends_on('[email protected]:', when='+python') | ||
depends_on('py-six', when='+python') | ||
depends_on('py-deprecated', when='+python') | ||
depends_on('py-psutil', when='+python') | ||
depends_on('[email protected]:', when='+python') | ||
depends_on('swig', when='+python') | ||
depends_on('[email protected]:', when='+python', type=('build', 'run', 'test')) | ||
depends_on('[email protected]:', when='+python', type=('build', 'run', 'test')) | ||
depends_on('py-six', when='+python', type=('build', 'run', 'test')) | ||
depends_on('py-deprecated', when='+python', type=('build', 'run', 'test')) | ||
depends_on('py-psutil', when='+python', type=('build', 'run', 'test')) | ||
depends_on('[email protected]:', when='+python', type=('build', 'run', 'test')) | ||
depends_on('swig', when='+python', type=('build', 'run', 'test')) | ||
|
||
patch('include_path.patch') | ||
|
||
def patch(self): | ||
files = glob.glob("tests/**/Makefile", recursive=True) | ||
filter_file('\$\(GTEST_DIR\)/src/gtest-all\.cc \$\(GTEST_DIR\)/src/gtest_main\.cc', | ||
'-L$(GTEST_DIR) -lgtest', *files) | ||
|
||
def build(self, spec, prefix): | ||
make('PREFIX={}'.format(prefix), 'install') | ||
if '+python' in self.spec: | ||
|
@@ -44,6 +52,8 @@ def install(self, spec, prefix): | |
install_tree('include', prefix.include) | ||
mkdirp(prefix.src.genn) | ||
install_tree('src/genn', prefix.src.genn) | ||
install_tree('tests', prefix.tests) | ||
install('version.txt', prefix) | ||
if '+python' in self.spec: | ||
super(Genn, self).install(spec, prefix) | ||
|
||
|
@@ -53,3 +63,17 @@ def setup_run_environment(self, env): | |
env.append_path('CUDA_PATH', self.spec['cuda'].prefix) | ||
if '+python' in self.spec: | ||
super(Genn, self).setup_run_environment(env) | ||
|
||
def test(self): | ||
env['GTEST_DIR'] = self.spec['googletest'].prefix | ||
# workaround for https://github.com/spack/spack/issues/20553 | ||
env['PATH'] = '{}:{}'.format(self.spec['lcov'].prefix.bin, env['PATH']) | ||
# overriding automatic python testing | ||
with working_dir(self.prefix.tests): | ||
# FIXME: | ||
# * expects a non-zero return code for errors | ||
# * also too slow for a simple install test? | ||
# ⇒ provide another simple install test? | ||
self.run_test('run_tests.sh') | ||
if '+python' in self.spec: | ||
super(Genn, self).test(self) |