diff --git a/packages/dune/package.py b/packages/dune/package.py index 19764c1..0dc6a40 100644 --- a/packages/dune/package.py +++ b/packages/dune/package.py @@ -24,8 +24,6 @@ import os from spack import * - - class Dune(CMakePackage): """ DUNE, the Distributed and Unified Numerics Environment is a modular toolbox for solving partial differential equations (PDEs) with grid-based methods. @@ -265,32 +263,28 @@ class Dune(CMakePackage): def cmake(self, spec, prefix): if self.stage.archive_file: os.remove(self.stage.archive_file) - optFile = open(self.stage.source_path+"/../dune.opts", "w") - optFile.write('CMAKE_FLAGS="') - for flag in self.cmake_args(): - optFile.write(flag.replace("\"", "'")+" ") - optFile.write('-DCMAKE_INSTALL_PREFIX=%s' % prefix) - optFile.write('"') - optFile.close() - set_executable('bin/dunecontrol') + + # Write an opts file for later use + with open(join_path(self.stage.source_path, "..", "dune.opts"), "w") as optFile: + optFile.write('CMAKE_FLAGS="') + for flag in self.cmake_args(): + optFile.write(flag.replace("\"", "'")+" ") + optFile.write('-DCMAKE_INSTALL_PREFIX=%s' % prefix) + optFile.write('"') + installer = Executable('bin/dunecontrol') - options_file=self.stage.source_path+"/../dune.opts" + options_file = join_path(self.stage.source_path, "..", "dune.opts") installer('--builddir=%s'%self.build_directory , '--opts=%s' % options_file, 'cmake') - pass def install(self, spec, prefix): - set_executable('bin/dunecontrol') installer = Executable('bin/dunecontrol') - options_file=self.stage.source_path+"/../dune.opts" + options_file = join_path(self.stage.source_path, "..", "dune.opts") installer('--builddir=%s'%self.build_directory , '--opts=%s' % options_file, 'make', 'install') - pass def build(self, spec, prefix): - set_executable('bin/dunecontrol') installer = Executable('bin/dunecontrol') - options_file=self.stage.source_path+"/../dune.opts" + options_file = join_path(self.stage.source_path, "..", "dune.opts") installer('--builddir=%s'%self.build_directory , '--opts=%s' % options_file, 'make') - pass @run_after('install') def install_python_components(self):