edm4hep: added package at v0.3, updated podio at v0.13 (#20241)

This commit is contained in:
vvolkl 2020-12-07 18:58:10 +01:00 committed by GitHub
parent ed258ca9e9
commit 8035a52f7b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 109 additions and 21 deletions

View file

@ -0,0 +1,72 @@
# Copyright 2013-2020 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)
class Edm4hep(CMakePackage):
"""Event data model of Key4hep."""
homepage = "https://github.com/key4hep/EDM4hep"
url = "https://github.com/key4hep/EDM4hep/archive/v00-01.tar.gz"
git = "https://github.com/key4hep/EDM4hep.git"
maintainers = ['vvolkl']
tags = ["hep", "key4hep"]
version('master', branch='master')
version('0.3', sha256='d0ad8a486c3ed1659ea97d47b268fe56718fdb389b5935f23ba93804e4d5fbc5')
variant('cxxstd',
default='17',
values=('17',),
multi=False,
description='Use the specified C++ standard when building.')
depends_on('cmake@3.3:', type='build')
depends_on('python', type='build')
depends_on('root@6.08:')
depends_on('podio@0.13:')
depends_on('hepmc@:2.99.99', type='test')
depends_on('heppdt', type='test')
def cmake_args(self):
args = []
# C++ Standard
args.append(self.define('CMAKE_CXX_STANDARD',
self.spec.variants['cxxstd'].value))
return args
def url_for_version(self, version):
"""Translate version numbers to ilcsoft conventions.
in spack, the convention is: 0.1 (or 0.1.0) 0.1.1, 0.2, 0.2.1 ...
in ilcsoft, releases are dashed and padded with a leading zero
the patch version is omitted when 0
so for example v01-12-01, v01-12 ...
:param self: spack package class that has a url
:type self: class: `spack.PackageBase`
:param version: version
:type param: str
"""
base_url = self.url.rsplit('/', 1)[0]
if len(version) == 1:
major = version[0]
minor, patch = 0, 0
elif len(version) == 2:
major, minor = version
patch = 0
else:
major, minor, patch = version
# By now the data is normalized enough to handle it easily depending
# on the value of the patch version
if patch == 0:
version_str = 'v%02d-%02d.tar.gz' % (major, minor)
else:
version_str = 'v%02d-%02d-%02d.tar.gz' % (major, minor, patch)
return base_url + '/' + version_str

View file

@ -3,8 +3,6 @@
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Podio(CMakePackage):
"""PODIO, or plain-old-data I/O, is a C++ library to support the creation
@ -19,12 +17,13 @@ class Podio(CMakePackage):
tags = ["hep", "key4hep"]
version('master', branch='master')
version('0.12.0', sha256='1729a2ce21e8b307fc37dfb9a9f5ae031e9f4be4992385cf99dba3e5fdf5323a')
version('0.11.0', sha256='4b2765566a14f0ddece2c894634e0a8e4f42f3e44392addb9110d856f6267fb6')
version('0.10.0', sha256='b5b42770ec8b96bcd2748abc05669dd3e4d4cc84f81ed57d57d2eda1ade90ef2')
version('0.13', sha256='e9cbd4e25730003d3706ad82e28b15cb5bdc524a78b0a26e90b89ea852101498')
version('0.12', sha256='1729a2ce21e8b307fc37dfb9a9f5ae031e9f4be4992385cf99dba3e5fdf5323a')
version('0.11', sha256='4b2765566a14f0ddece2c894634e0a8e4f42f3e44392addb9110d856f6267fb6')
version('0.10', sha256='b5b42770ec8b96bcd2748abc05669dd3e4d4cc84f81ed57d57d2eda1ade90ef2')
version('0.9.2', sha256='8234d1b9636029124235ef81199a1220968dcc7fdaeab81cdc96a47af332d240')
version('0.9.0', sha256='3cde67556b6b76fd2d004adfaa3b3b6173a110c0c209792bfdb5f9353e21076f')
version('0.8.0', sha256='9d035a7f5ebfae5279a17405003206853271af692f762e2bac8e73825f2af327')
version('0.9', sha256='3cde67556b6b76fd2d004adfaa3b3b6173a110c0c209792bfdb5f9353e21076f')
version('0.8', sha256='9d035a7f5ebfae5279a17405003206853271af692f762e2bac8e73825f2af327')
variant('build_type', default='Release',
description='The build type to build',
@ -49,23 +48,40 @@ class Podio(CMakePackage):
def cmake_args(self):
args = [
self.define('BUILD_TESTING', self.run_tests),
self.define_from_variant('ENABLE_SIO', 'sio')
]
return args
def url_for_version(self, version):
# podio releases are dashes and padded with a leading zero
# the patch version is omitted when 0
# so for example v01-12-01, v01-12 ...
major = (str(version[0]).zfill(2))
minor = (str(version[1]).zfill(2))
patch = (str(version[2]).zfill(2))
if version[2] == 0:
url = "https://github.com/AIDASoft/podio/archive/v%s-%s.tar.gz" % (major, minor)
else:
url = "https://github.com/AIDASoft/podio/archive/v%s-%s-%s.tar.gz" % (major, minor, patch)
return url
def setup_run_environment(self, env):
env.prepend_path('PYTHONPATH', self.prefix.python)
def url_for_version(self, version):
"""Translate version numbers to ilcsoft conventions.
in spack, the convention is: 0.1 (or 0.1.0) 0.1.1, 0.2, 0.2.1 ...
in ilcsoft, releases are dashed and padded with a leading zero
the patch version is omitted when 0
so for example v01-12-01, v01-12 ...
:param self: spack package class that has a url
:type self: class: `spack.PackageBase`
:param version: version
:type param: str
"""
base_url = self.url.rsplit('/', 1)[0]
if len(version) == 1:
major = version[0]
minor, patch = 0, 0
elif len(version) == 2:
major, minor = version
patch = 0
else:
major, minor, patch = version
# By now the data is normalized enough to handle it easily depending
# on the value of the patch version
if patch == 0:
version_str = 'v%02d-%02d.tar.gz' % (major, minor)
else:
version_str = 'v%02d-%02d-%02d.tar.gz' % (major, minor, patch)
return base_url + '/' + version_str