|
| 1 | +# Copyright 2013-2024 Lawrence Livermore National Security, LLC and other |
| 2 | +# Spack Project Developers. See the top-level COPYRIGHT file for details. |
| 3 | +# |
| 4 | +# SPDX-License-Identifier: (Apache-2.0 OR MIT) |
| 5 | + |
| 6 | + |
| 7 | +from spack.package import * |
| 8 | + |
| 9 | + |
| 10 | +class G4channeling(Package): |
| 11 | + """Geant4 data for solid state crystal channeling""" |
| 12 | + |
| 13 | + homepage = "https://geant4.web.cern.ch" |
| 14 | + url = "https://geant4-data.web.cern.ch/geant4-data/datasets/G4CHANNELING.1.0.tar.gz" |
| 15 | + |
| 16 | + tags = ["hep"] |
| 17 | + |
| 18 | + maintainers("drbenmorgan") |
| 19 | + |
| 20 | + # Only versions relevant to Geant4 releases built by spack are added |
| 21 | + version("1.0", sha256="203e3c69984ca09acd181a1d31a9b0efafad4bc12e6c608f0b05e695120d67f2") |
| 22 | + |
| 23 | + def install(self, spec, prefix): |
| 24 | + mkdirp(join_path(prefix.share, "data")) |
| 25 | + install_path = join_path(prefix.share, "data", self.g4datasetname) |
| 26 | + install_tree(self.stage.source_path, install_path) |
| 27 | + |
| 28 | + def setup_dependent_run_environment(self, env, dependent_spec): |
| 29 | + install_path = join_path(self.prefix.share, "data", self.g4datasetname) |
| 30 | + env.set("G4CHANNELINGDATA", install_path) |
| 31 | + |
| 32 | + def url_for_version(self, version): |
| 33 | + """Handle version string.""" |
| 34 | + return f"http://geant4-data.web.cern.ch/geant4-data/datasets/G4CHANNELING.{version}.tar.gz" |
| 35 | + |
| 36 | + @property |
| 37 | + def g4datasetname(self): |
| 38 | + return f"G4CHANNELING{self.spec.version}" |
0 commit comments