Skip to content

Commit

Permalink
Merge pull request #399 from lanl/rbberger_simpler_plugins
Browse files Browse the repository at this point in the history
treat plugins as code dependencies
  • Loading branch information
rbberger authored Jul 26, 2024
2 parents 235b3b6 + dab5840 commit 864c674
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions spack-repo/packages/singularity-eos/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@


@directive("singularity_eos_plugins")
def singularity_eos_plugin(name, path):
def singularity_eos_plugin(name, spackage, relpath):
def _execute_register(pkg):
pkg.plugins[name] = path
pkg.plugins[name] = (spackage, relpath)

return _execute_register

Expand Down Expand Up @@ -82,7 +82,7 @@ class SingularityEos(CMakePackage, CudaPackage):

plugins = {}

singularity_eos_plugin("dust", "example/plugin")
singularity_eos_plugin("dust", "self", "example/plugin")

variant(
"plugins",
Expand Down Expand Up @@ -218,11 +218,23 @@ def cmake_args(self):

if self.spec.satisfies("@1.9.0:"):
if "none" not in self.spec.variants["plugins"].value:
pdirs = [join_path(self.stage.source_path, self.plugins[p]) for p in self.spec.variants["plugins"].value]
pdirs = []
for p in self.spec.variants["plugins"].value:
spackage, path = self.plugins[p]
if spackage == "self":
pdirs.append(join_path(self.stage.source_path, path))
else:
pdirs.append(join_path(self.spec[spackage].prefix, path))
args.append(self.define("SINGULARITY_PLUGINS", ";".join(pdirs)))

if self.spec.variants["variant"].value != "default":
args.append(self.define_from_variant("SINGULARITY_VARIANT", "variant"))
variant_path = self.spec.variants["variant"].value
if variant_path != "default":
parts = os.path.normpath('variant_path').split(os.sep)
if parts[0] in self.plugins.keys():
spackage, path = self.plugins[parts[0]]
parts[0] = self.spec[spackage].prefix
variant_path = join_path(*parts)
args.append(self.define("SINGULARITY_VARIANT", variant_path))

#TODO: do we need this?
if "+kokkos+cuda" in self.spec:
Expand Down

0 comments on commit 864c674

Please sign in to comment.