From fffc2d2765d8bdcdb87aba5aaa2140fa6819a59a Mon Sep 17 00:00:00 2001 From: Glenn Johnson Date: Sat, 14 May 2016 19:33:45 -0500 Subject: Updated turbomole package file. This PR updates the turbomole package file but does not introduce any new funtionality. The updtes are: - use spack interface for subprocess.PIPE and subprocess.Popen - clean up based on flake8 - remove some extra whitespace --- .../repos/builtin/packages/turbomole/package.py | 76 +++++++++++++--------- 1 file changed, 46 insertions(+), 30 deletions(-) (limited to 'var') diff --git a/var/spack/repos/builtin/packages/turbomole/package.py b/var/spack/repos/builtin/packages/turbomole/package.py index 3362113d13..6ccce23f97 100644 --- a/var/spack/repos/builtin/packages/turbomole/package.py +++ b/var/spack/repos/builtin/packages/turbomole/package.py @@ -26,21 +26,22 @@ from spack import * import os import subprocess + class Turbomole(Package): """TURBOMOLE: Program Package for ab initio Electronic Structure Calculations. NB: Requires a license to download.""" - - # NOTE: Turbomole requires purchase of a license to download. Go to the - # NOTE: Turbomole home page, http://www.turbomole-gmbh.com, for details. - # NOTE: Spack will search the current directory for this file. It is - # NOTE: probably best to add this file to a Spack mirror so that it can be - # NOTE: found from anywhere. For information on setting up a Spack mirror - # NOTE: see http://software.llnl.gov/spack/mirrors.html + + # NOTE: Turbomole requires purchase of a license to download. Go to the + # NOTE: Turbomole home page, http://www.turbomole-gmbh.com, for details. + # NOTE: Spack will search the current directory for this file. It is + # NOTE: probably best to add this file to a Spack mirror so that it can be + # NOTE: found from anywhere. For information on setting up a Spack mirror + # NOTE: see http://software.llnl.gov/spack/mirrors.html homepage = "http://www.turbomole-gmbh.com/" version('7.0.2', '92b97e1e52e8dcf02a4d9ac0147c09d6', - url="file://%s/turbolinux702.tar.gz" % os.getcwd()) + url="file://%s/turbolinux702.tar.gz" % os.getcwd()) variant('mpi', default=False, description='Set up MPI environment') variant('smp', default=False, description='Set up SMP environment') @@ -56,33 +57,31 @@ class Turbomole(Package): def do_fetch(self, mirror_only=True): if '+mpi' in self.spec and '+smp' in self.spec: - raise InstallError('Can not have both SMP and MPI enabled in the same build.') + raise InstallError('Can not have both SMP and MPI enabled in the ' + 'same build.') super(Turbomole, self).do_fetch(mirror_only) def get_tm_arch(self): - # For python-2.7 we could use `tm_arch = subprocess.check_output()` - # Use the following for compatibility with python 2.6 if 'TURBOMOLE' in os.getcwd(): - tm_arch = subprocess.Popen(['sh', 'scripts/sysname'], - stdout=subprocess.PIPE).communicate()[0] + tm_sysname = Executable('./scripts/sysname') + tm_arch = tm_sysname(output=str) return tm_arch.rstrip('\n') else: return - + def install(self, spec, prefix): if spec.satisfies('@:7.0.2'): calculate_version = 'calculate_2.4_linux64' molecontrol_version = 'MoleControl_2.5' - tm_arch=self.get_tm_arch() + tm_arch = self.get_tm_arch() tar = which('tar') dst = join_path(prefix, 'TURBOMOLE') tar('-x', '-z', '-f', 'thermocalc.tar.gz') with working_dir('thermocalc'): - cmd = 'sh install <<