From 87c7a7e1039abd8c2a188498ae8367492937cc88 Mon Sep 17 00:00:00 2001 From: Marie Houillon Date: Mon, 27 Sep 2021 20:21:43 +0200 Subject: New packages for openCARP (#25909) Co-authored-by: Tamara Dahlgren <35777542+tldahlgren@users.noreply.github.com> --- .../repos/builtin/packages/meshtool/package.py | 23 ++++++++ .../builtin/packages/opencarp/opencarp7.patch | 52 +++++++++++++++++ .../repos/builtin/packages/opencarp/package.py | 68 ++++++++++++++++++++++ .../repos/builtin/packages/py-carputils/package.py | 31 ++++++++++ 4 files changed, 174 insertions(+) create mode 100644 var/spack/repos/builtin/packages/meshtool/package.py create mode 100644 var/spack/repos/builtin/packages/opencarp/opencarp7.patch create mode 100644 var/spack/repos/builtin/packages/opencarp/package.py create mode 100644 var/spack/repos/builtin/packages/py-carputils/package.py diff --git a/var/spack/repos/builtin/packages/meshtool/package.py b/var/spack/repos/builtin/packages/meshtool/package.py new file mode 100644 index 0000000000..57805430c8 --- /dev/null +++ b/var/spack/repos/builtin/packages/meshtool/package.py @@ -0,0 +1,23 @@ +# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +from spack import * + + +class Meshtool(MakefilePackage): + """Meshtool - A mesh manipulation utility""" + + homepage = "https://bitbucket.org/aneic/meshtool/" + git = "https://bitbucket.org/aneic/meshtool.git" + + maintainers = ['MarieHouillon'] + + version('master', branch='master') + # Version to use with opencarp@7.0 + version('oc7.0', commit="6c5cfbd067120901f15a04bf63beec409bda6dc9") + + def install(self, spec, prefix): + mkdirp(prefix.bin) + install('meshtool', prefix.bin) diff --git a/var/spack/repos/builtin/packages/opencarp/opencarp7.patch b/var/spack/repos/builtin/packages/opencarp/opencarp7.patch new file mode 100644 index 0000000000..6588d9bf77 --- /dev/null +++ b/var/spack/repos/builtin/packages/opencarp/opencarp7.patch @@ -0,0 +1,52 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 1c77521..ac421ca 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -145,4 +145,4 @@ install(CODE "execute_process(COMMAND sh -c \"bash ${CMAKE_CURRENT_LIST_DIR}/cma + ) + + +-include(CPackConfig) ++#include(CPackConfig) +diff --git a/cmake/postinst b/cmake/postinst +index 7f1e249..0df6777 100644 +--- a/cmake/postinst ++++ b/cmake/postinst +@@ -1,16 +1,16 @@ + #!/bin/bash + +-INST_DIR="/usr/local/lib/opencarp" ++#INST_DIR="/usr/local/lib/opencarp" + +-if [ "$(uname -s)" == "Linux" ]; then +- echo $INST_DIR/lib > /etc/ld.so.conf.d/opencarp.conf +- ldconfig +-fi ++#if [ "$(uname -s)" == "Linux" ]; then ++# echo $INST_DIR/lib > /etc/ld.so.conf.d/opencarp.conf ++# ldconfig ++#fi + + # link binaries +-ln -sf $INST_DIR/bin/* /usr/local/bin/ +-ln -sf $INST_DIR/lib/openmpi/bin/mpirun /usr/local/bin/mpirun +-ln -sf $INST_DIR/lib/openmpi/bin/mpiexec /usr/local/bin/mpiexec ++#ln -sf $INST_DIR/bin/* /usr/local/bin/ ++#ln -sf $INST_DIR/lib/openmpi/bin/mpirun /usr/local/bin/mpirun ++#ln -sf $INST_DIR/lib/openmpi/bin/mpiexec /usr/local/bin/mpiexec + + # install carputils + if [ -d "$INST_DIR/share/carputils" ]; then +diff --git a/simulator/build_info.py b/simulator/build_info.py +index 7ef8aec..0b51aaa 100644 +--- a/simulator/build_info.py ++++ b/simulator/build_info.py +@@ -168,7 +168,7 @@ TEMPLATE = """#ifndef __BUILD_INFO__ + + def generate(): + +- info = git() ++ info = git(os.path.dirname(os.path.abspath(__file__))) + + # Get subrepo info + repo_versions = [] diff --git a/var/spack/repos/builtin/packages/opencarp/package.py b/var/spack/repos/builtin/packages/opencarp/package.py new file mode 100644 index 0000000000..680c858a95 --- /dev/null +++ b/var/spack/repos/builtin/packages/opencarp/package.py @@ -0,0 +1,68 @@ +# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +import os +from datetime import datetime + +from spack import * + + +class Opencarp(CMakePackage): + """The openCARP simulation software, + an open cardiac electrophysiology simulator for in-silico experiments.""" + + homepage = "https://www.opencarp.org" + git = "https://git.opencarp.org/openCARP/openCARP.git" + + maintainers = ['MarieHouillon'] + + version('7.0', commit='78da9195', submodules=False, no_cache=True, preferred=True) + version('master', branch='master', submodules=False, no_cache=True) + + variant('carputils', default=False, description='Installs the carputils framework') + variant('meshtool', default=False, description='Installs the meshtool software') + + # Patch removing problematic steps in CMake process + patch('opencarp7.patch', when='@7.0') + + depends_on('git') + depends_on('petsc') + depends_on('binutils') + depends_on('gengetopt') + depends_on('pkgconfig') + depends_on('python@:3.8') + depends_on('zlib') + depends_on('perl') + + depends_on('py-carputils') + depends_on('meshtool') + # Use specific versions of carputils and meshtool for releases + for ver in ['7.0']: + depends_on('py-carputils@oc' + ver, when='@' + ver + ' +carputils') + depends_on('meshtool@oc' + ver, when='@' + ver + ' +meshtool') + + def cmake_args(self): + return [ + self.define('DLOPEN', True), + self.define('SPACK_BUILD', True) + ] + + @run_after('install') + def post_install(self): + # If carputils has been installed, a new settings file + # with right executable paths is generated + if '+carputils' in self.spec: + settings_prefix = os.path.expanduser(join_path('~', '.config', 'carputils')) + settings_file = join_path(settings_prefix, 'settings.yaml') + if os.path.exists(settings_file): + print('Backup the existing settings.yaml...') + os.rename(settings_file, + join_path( + settings_prefix, + 'settings.yaml.' + + datetime.today().strftime('%Y-%m-%d-%H:%M:%S'))) + cusettings = Executable('cusettings') + cusettings(settings_file, '--flavor', 'petsc', + '--software-root', self.prefix.bin) diff --git a/var/spack/repos/builtin/packages/py-carputils/package.py b/var/spack/repos/builtin/packages/py-carputils/package.py new file mode 100644 index 0000000000..52822fb70c --- /dev/null +++ b/var/spack/repos/builtin/packages/py-carputils/package.py @@ -0,0 +1,31 @@ +# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + + +class PyCarputils(PythonPackage): + """The carputils framework for running simulations with the openCARP software.""" + + homepage = "https://www.opencarp.org" + git = "https://git.opencarp.org/openCARP/carputils.git" + + maintainers = ['MarieHouillon'] + + version('master', branch='master') + # Version to use with openCARP 7.0 + version('oc7.0', commit='4c04db61744f2fb7665594d7c810699c5c55c77c') + + depends_on('git') + + depends_on('python@:3.8', type=('build', 'run')) + depends_on('py-pip', type='build') + depends_on('py-numpy@1.14.5:', type=('build', 'run')) + depends_on('py-setuptools', type='build') + depends_on('py-python-dateutil', type='run') + depends_on('py-scipy@:1.5.4', type='run') + depends_on('py-matplotlib@:3.3.3', type='run') + depends_on('py-pandas@:1.1.4', type='run') + depends_on('py-tables@3.6.1', type='run') + depends_on('py-six@:1.14.0', type='run') + depends_on('py-ruamel-yaml', type='run') -- cgit v1.2.3-60-g2f50