lhapdfsets: add new package (#25477)
This commit is contained in:
parent
b7bb687d17
commit
b700335be7
@ -3,8 +3,6 @@
|
|||||||
#
|
#
|
||||||
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||||
|
|
||||||
import shutil
|
|
||||||
|
|
||||||
from spack import *
|
from spack import *
|
||||||
|
|
||||||
|
|
||||||
@ -22,35 +20,25 @@ class Herwig3(AutotoolsPackage):
|
|||||||
depends_on('automake', type='build')
|
depends_on('automake', type='build')
|
||||||
depends_on('libtool', type='build')
|
depends_on('libtool', type='build')
|
||||||
depends_on('m4', type='build')
|
depends_on('m4', type='build')
|
||||||
depends_on('lhapdf', type='link')
|
depends_on('lhapdf')
|
||||||
depends_on('thepeg@2.2.1', when='@7.2.1', type='link')
|
depends_on('lhapdfsets')
|
||||||
depends_on('boost', type='link')
|
depends_on('thepeg@2.2.1', when='@7.2.1')
|
||||||
|
depends_on('boost')
|
||||||
depends_on('python', type=('build', 'run'))
|
depends_on('python', type=('build', 'run'))
|
||||||
depends_on('gsl', type='link')
|
depends_on('gsl')
|
||||||
depends_on('fastjet', type='link')
|
depends_on('fastjet')
|
||||||
depends_on('vbfnlo@3:', type='link')
|
depends_on('vbfnlo@3:')
|
||||||
depends_on('madgraph5amc', type='link')
|
depends_on('madgraph5amc')
|
||||||
depends_on('njet', type='link')
|
depends_on('njet')
|
||||||
depends_on('py-gosam', type='link', when='^python@2.7.0:2.7')
|
depends_on('py-gosam', when='^python@2.7.0:2.7')
|
||||||
depends_on('gosam-contrib', type='link')
|
depends_on('gosam-contrib')
|
||||||
depends_on('openloops', type='link')
|
depends_on('openloops')
|
||||||
|
|
||||||
force_autoreconf = True
|
force_autoreconf = True
|
||||||
|
|
||||||
def autoreconf(self, spec, prefix):
|
def autoreconf(self, spec, prefix):
|
||||||
autoreconf('--install', '--verbose', '--force')
|
autoreconf('--install', '--verbose', '--force')
|
||||||
|
|
||||||
@run_before('build')
|
|
||||||
def install_lhapdfsets(self):
|
|
||||||
mkdirp(self.prefix.tmppdfsets)
|
|
||||||
lhapdf = which('lhapdf')
|
|
||||||
if self.spec.satisfies('@7.2.0:'):
|
|
||||||
lhapdf("--pdfdir=" + self.prefix.tmppdfsets,
|
|
||||||
# "--source=/cvmfs/sft.cern.ch/lcg/external/lhapdfsets/current",
|
|
||||||
# "--listdir=/cvmfs/sft.cern.ch/lcg/external/lhapdfsets/current",
|
|
||||||
"install", "MHT2014lo68cl", "MMHT2014nlo68cl",
|
|
||||||
"CT14lo", "CT14nlo")
|
|
||||||
|
|
||||||
def configure_args(self):
|
def configure_args(self):
|
||||||
args = ['--with-gsl=' + self.spec['gsl'].prefix,
|
args = ['--with-gsl=' + self.spec['gsl'].prefix,
|
||||||
'--with-thepeg=' + self.spec['thepeg'].prefix,
|
'--with-thepeg=' + self.spec['thepeg'].prefix,
|
||||||
@ -69,18 +57,14 @@ def configure_args(self):
|
|||||||
return args
|
return args
|
||||||
|
|
||||||
def flag_handler(self, name, flags):
|
def flag_handler(self, name, flags):
|
||||||
if name == 'fcflags':
|
if name == 'fflags':
|
||||||
flags.append('-std=legacy')
|
flags.append('-std=legacy')
|
||||||
return (None, flags, None)
|
return (flags, None, None)
|
||||||
elif name in ['cflags', 'cxxflags', 'cppflags']:
|
|
||||||
return (None, flags, None)
|
|
||||||
|
|
||||||
return (flags, None, None)
|
return (flags, None, None)
|
||||||
|
|
||||||
def setup_build_environment(self, env):
|
def setup_build_environment(self, env):
|
||||||
thepeg_home = self.spec['thepeg'].prefix
|
thepeg_home = self.spec['thepeg'].prefix
|
||||||
env.prepend_path('LD_LIBRARY_PATH', thepeg_home.lib.ThePEG)
|
env.prepend_path('LD_LIBRARY_PATH', thepeg_home.lib.ThePEG)
|
||||||
env.set('LHAPDF_DATA_PATH', self.prefix.tmppdfsets)
|
|
||||||
env.set('HERWIGINCLUDE', '-I' + self.prefix.include)
|
env.set('HERWIGINCLUDE', '-I' + self.prefix.include)
|
||||||
env.set('BOOSTINCLUDE', '-I' + self.spec['boost'].prefix.include)
|
env.set('BOOSTINCLUDE', '-I' + self.spec['boost'].prefix.include)
|
||||||
env.set('HERWIGINSTALL', self.prefix)
|
env.set('HERWIGINSTALL', self.prefix)
|
||||||
@ -94,7 +78,3 @@ def install(self, spec, prefix):
|
|||||||
make('install')
|
make('install')
|
||||||
with working_dir('MatrixElement/FxFx'):
|
with working_dir('MatrixElement/FxFx'):
|
||||||
make('install')
|
make('install')
|
||||||
|
|
||||||
@run_after('install')
|
|
||||||
def remove_lhapdfsets(self):
|
|
||||||
shutil.rmtree(self.prefix.tmppdfsets)
|
|
||||||
|
61
var/spack/repos/builtin/packages/lhapdfsets/package.py
Normal file
61
var/spack/repos/builtin/packages/lhapdfsets/package.py
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
# 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 spack import *
|
||||||
|
|
||||||
|
|
||||||
|
class Lhapdfsets(BundlePackage):
|
||||||
|
"""A set of disretised data files of parton density functions ,
|
||||||
|
to be used with the LHAPDF library"""
|
||||||
|
|
||||||
|
homepage = "https://lhapdf.hepforge.org/pdfsets.html"
|
||||||
|
|
||||||
|
tags = ['hep']
|
||||||
|
|
||||||
|
maintainers = ['vvolkl']
|
||||||
|
|
||||||
|
version('6.3.0')
|
||||||
|
|
||||||
|
depends_on('lhapdf', type='build')
|
||||||
|
|
||||||
|
phases = ['install']
|
||||||
|
|
||||||
|
# use a dummy executables for spack external support
|
||||||
|
executables = [r'^lhapdf$']
|
||||||
|
|
||||||
|
variant('sets', description="Individiual lhapdf sets to install", values=('all', 'default'), default='default')
|
||||||
|
|
||||||
|
def install(self, spec, prefix):
|
||||||
|
mkdirp(self.prefix.share.lhapdfsets)
|
||||||
|
lhapdf = which('lhapdf')
|
||||||
|
sets = self.spec.variants['sets'].value
|
||||||
|
if sets == 'all':
|
||||||
|
# parse set names from index file
|
||||||
|
all_sets = [_line.split()[1] for _line in
|
||||||
|
open(join_path(os.path.dirname(__file__),
|
||||||
|
'pdfsets.index')).readlines()]
|
||||||
|
sets = all_sets
|
||||||
|
elif sets == 'default':
|
||||||
|
default_sets = ["MMHT2014lo68cl", "MMHT2014nlo68cl", "CT14lo", "CT14nlo"]
|
||||||
|
sets = default_sets
|
||||||
|
lhapdf("--pdfdir=" + self.prefix.share.lhapdfsets,
|
||||||
|
"install", *sets)
|
||||||
|
|
||||||
|
def setup_dependent_build_environment(self, env, dependent_spec):
|
||||||
|
env.set('LHAPDF_DATA_PATH', self.prefix.share.lhapdfsets)
|
||||||
|
|
||||||
|
def setup_run_environment(self, env):
|
||||||
|
env.set('LHAPDF_DATA_PATH', self.prefix.share.lhapdfsets)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def determine_spec_details(cls, prefix, exes_in_prefix):
|
||||||
|
path = os.environ.get('LHAPDF_DATA_PATH', None)
|
||||||
|
# unfortunately the sets are not versioned -
|
||||||
|
# just hardcode the current version and hope it is fine
|
||||||
|
s = Spec.from_detection('lhapdfsets@6.3.0')
|
||||||
|
s.external_path = path
|
||||||
|
return s if path else None
|
1045
var/spack/repos/builtin/packages/lhapdfsets/pdfsets.index
Normal file
1045
var/spack/repos/builtin/packages/lhapdfsets/pdfsets.index
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user