Add sio and add it as possible dependency for podio (#19875)

Newest podio can use SIO as backend
This commit is contained in:
Thomas Madlener 2020-11-13 19:43:43 +01:00 committed by GitHub
parent fbde1abc8c
commit d5b89b422d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 65 additions and 1 deletions

View File

@ -28,6 +28,9 @@ class Podio(CMakePackage):
description='The build type to build',
values=('Debug', 'Release'))
variant('sio', default=False,
description='Build the SIO I/O backend')
# cpack config throws an error on some systems
patch('cpack.patch', when="@:0.10.0")
patch('dictloading.patch', when="@0.10.0")
@ -38,9 +41,15 @@ class Podio(CMakePackage):
depends_on('python', type=('build', 'run'))
depends_on('py-pyyaml', type=('build', 'run'))
depends_on('py-jinja2@2.10.1:', type=('build', 'run'), when='@0.12.0:')
depends_on('sio', type=('build', 'run'), when='+sio')
conflicts('+sio', when='@:0.12', msg='sio support requires at least podio@0.13')
def cmake_args(self):
args = ['-DBUILD_TESTING=%s' % self.run_tests, ]
args = [
self.define('BUILD_TESTING', self.run_tests),
self.define_from_variants('ENABLE_SIO', 'sio')
]
return args
def url_for_version(self, version):

View File

@ -0,0 +1,55 @@
# 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)
from spack import *
class Sio(CMakePackage):
"""SIO is a persistency solution for reading and writing binary data in SIO
structures called record and block. SIO has originally been implemented as
persistency layer for LCIO.
"""
url = "https://github.com/iLCSoft/SIO/archive/v00-00-02.tar.gz"
homepage = "https://github.com/iLCSoft/SIO"
git = "https://github.com/iLCSoft/SIO.git"
maintainers = ['vvolkl', 'tmadlener']
version('master', branch='master')
version('0.0.3', sha256='4c8b9c08480fb53cd10abb0e1260071a8c3f68d06a8acfd373f6560a916155cc')
version('0.0.2', sha256='e4cd2aeaeaa23c1da2c20c5c08a9b72a31b16b7a8f5aa6d480dcd561ef667657')
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