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>
This commit is contained in:
iarspider 2020-02-23 19:07:00 +01:00 committed by GitHub
parent b927e3799f
commit fd60977613
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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"