diff options
author | iarspider <iarspider@gmail.com> | 2020-02-23 19:07:00 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-23 12:07:00 -0600 |
commit | fd609776130d8ddc3d6bee0cdec9fe88653670b3 (patch) | |
tree | 3dc8f6039e7b467dd7c5c8c1b95136c560426c1c | |
parent | b927e3799f1ef8c9e12886a45566dfc66b93031e (diff) | |
download | spack-fd609776130d8ddc3d6bee0cdec9fe88653670b3.tar.gz spack-fd609776130d8ddc3d6bee0cdec9fe88653670b3.tar.bz2 spack-fd609776130d8ddc3d6bee0cdec9fe88653670b3.tar.xz spack-fd609776130d8ddc3d6bee0cdec9fe88653670b3.zip |
Separate HepMC2 and HepMC3 build recipes; Python3 support for HepMC3 (#15147)
* Fixes & additional variant(s) for HepMC3
* Syntax
* Restore recipe for HepMC2
* Remove FIXME
* Update package.py
* Apply suggestions from code review
Co-Authored-By: Adam J. Stewart <ajstewart426@gmail.com>
Co-authored-by: Adam J. Stewart <ajstewart426@gmail.com>
-rw-r--r-- | var/spack/repos/builtin/packages/hepmc/package.py | 34 |
1 files changed, 28 insertions, 6 deletions
diff --git a/var/spack/repos/builtin/packages/hepmc/package.py b/var/spack/repos/builtin/packages/hepmc/package.py index 2828a179ff..d208e7ecde 100644 --- a/var/spack/repos/builtin/packages/hepmc/package.py +++ b/var/spack/repos/builtin/packages/hepmc/package.py @@ -28,24 +28,46 @@ class Hepmc(CMakePackage): variant('python', default=False, description='Enable Python bindings') variant('rootio', default=False, description='Enable ROOT I/O') + variant('interfaces', default=False, description='Install interfaces for some Monte-Carlo Event Gens') depends_on('cmake@2.8.9:', type='build') - # FIXME: Officially supports Python3, but the build system doesn't find it - depends_on('python@:2.99.99', when='+python') + depends_on('python', when='+python') depends_on('root', when='+rootio') - conflicts('+python', when='@:3.1.99') - conflicts('+rootio', when='@:2.99.99') + conflicts('+python', when='@:3.1') + conflicts('+rootio', when='@:2') + conflicts('+interfaces', when='@:2') + @when('@:2') + def cmake_args(self): + return ['-Dmomentum:STRING=GEV', '-Dlength:STRING=MM'] + + @when('@3:') def cmake_args(self): spec = self.spec - return [ + args = [ '-Dmomentum:STRING=GEV', '-Dlength:STRING=MM', '-DHEPMC3_ENABLE_PYTHON={0}'.format(spec.satisfies('+python')), - '-DHEPMC3_ENABLE_ROOTIO={0}'.format(spec.satisfies('+rootio')) + '-DHEPMC3_ENABLE_ROOTIO={0}'.format(spec.satisfies('+rootio')), + '-DHEPMC3_INSTALL_INTERFACES={0}'.format( + spec.satisfies('+interfaces')), ] + if self.spec.satisfies('+python'): + py_ver = spec['python'].version.up_to(2) + py_sitepkg = join_path(self.prefix, site_packages_dir) + args.extend([ + '-DHEPMC3_PYTHON_VERSIONS={0}'.format(py_ver), + '-DHEPMC3_Python_SITEARCH{0}={1}'.format( + py_ver.joined, py_sitepkg) + ]) + + if self.spec.satisfies('+rootio'): + args.append('-DROOT_DIR={0}'.format(self.spec['root'].prefix)) + + return args + def url_for_version(self, version): if version > Version("3.0.0"): url = "http://hepmc.web.cern.ch/hepmc/releases/HepMC3-{0}.tar.gz" |