Sophie

Sophie

distrib > Mageia > 9 > armv7hl > media > core-release-src > by-pkgid > e5f88c0d3b18c36f920adff70e165405 > files > 1

spack-0.19.1-0.20230207git25cb55c.1.mga9.src.rpm

diff --git a/etc/spack/defaults/config.yaml b/etc/spack/defaults/config.yaml
index eb0d4fc..a31c01d 100644
--- a/etc/spack/defaults/config.yaml
+++ b/etc/spack/defaults/config.yaml
@@ -31,7 +31,7 @@ config:
 
   # Locations where templates should be found
   template_dirs:
-    - $spack/share/spack/templates
+    - $share/spack/templates
 
   # Directory where licenses should be located
   license_dir: $spack/etc/spack/licenses
diff --git a/lib/spack/spack/paths.py b/lib/spack/spack/paths.py
index 6b35434..682ef0f 100644
--- a/lib/spack/spack/paths.py
+++ b/lib/spack/spack/paths.py
@@ -16,6 +16,9 @@
 #: This file lives in $prefix/lib/spack/spack/__file__
 prefix = llnl.util.filesystem.ancestor(__file__, 4)
 
+if prefix == '/usr':
+    prefix = '/'
+
 #: synonym for prefix
 spack_root = prefix
 
@@ -42,7 +45,10 @@
 test_path = os.path.join(module_path, "test")
 hooks_path = os.path.join(module_path, "hooks")
 opt_path = os.path.join(prefix, "opt")
-share_path = os.path.join(prefix, "share", "spack")
+if prefix == '/':
+    share_path = os.path.join('/usr', "share", "spack")
+else:
+    share_path = os.path.join(prefix, "share", "spack")
 etc_path = os.path.join(prefix, "etc", "spack")
 
 #
diff --git a/etc/spack/defaults/modules.yaml b/etc/spack/defaults/modules.yaml
index 8914a6a..552d181 100644
--- a/etc/spack/defaults/modules.yaml
+++ b/etc/spack/defaults/modules.yaml
@@ -37,8 +37,8 @@ modules:
   default:
     # Where to install modules
     roots:
-     tcl:    $spack/share/spack/modules
-     lmod:   $spack/share/spack/lmod
+     tcl:    $share/spack/modules
+     lmod:   $share/spack/lmod
     # What type of modules to use
     enable:
       - tcl
diff --git a/etc/spack/defaults/bootstrap.yaml b/etc/spack/defaults/bootstrap.yaml
index 464994d..000218c 100644
--- a/etc/spack/defaults/bootstrap.yaml
+++ b/etc/spack/defaults/bootstrap.yaml
@@ -10,11 +10,11 @@ bootstrap:
   # depending on its type.
   sources:
   - name: 'github-actions-v0.4'
-    metadata: $spack/share/spack/bootstrap/github-actions-v0.4
+    metadata: $share/spack/bootstrap/github-actions-v0.4
   - name: 'github-actions-v0.3'
-    metadata: $spack/share/spack/bootstrap/github-actions-v0.3
+    metadata: $share/spack/bootstrap/github-actions-v0.3
   - name: 'spack-install'
-    metadata: $spack/share/spack/bootstrap/spack-install
+    metadata: $share/spack/bootstrap/spack-install
   trusted:
     # By default we trust bootstrapping from sources and from binaries
     # produced on Github via the workflow
diff --git a/lib/spack/spack/test/cmd/bootstrap.py b/lib/spack/spack/test/cmd/bootstrap.py
index e969f7f..1f0c386 100644
--- a/lib/spack/spack/test/cmd/bootstrap.py
+++ b/lib/spack/spack/test/cmd/bootstrap.py
@@ -128,8 +128,8 @@ def test_enable_or_disable_fails_with_no_method(mutable_config):
 def test_enable_or_disable_fails_with_more_than_one_method(mutable_config):
     wrong_config = {
         "sources": [
-            {"name": "github-actions", "metadata": "$spack/share/spack/bootstrap/github-actions"},
-            {"name": "github-actions", "metadata": "$spack/share/spack/bootstrap/github-actions"},
+            {"name": "github-actions", "metadata": "$share/spack/bootstrap/github-actions"},
+            {"name": "github-actions", "metadata": "$share/spack/bootstrap/github-actions"},
         ],
         "trusted": {},
     }
@@ -166,7 +166,7 @@ def test_remove_and_add_a_source(mutable_config):
     assert not sources
 
     # Add it back and check we restored the initial state
-    _bootstrap("add", "github-actions", "$spack/share/spack/bootstrap/github-actions-v0.3")
+    _bootstrap("add", "github-actions", "$share/spack/bootstrap/github-actions-v0.3")
     sources = spack.bootstrap.core.bootstrapping_sources()
     assert len(sources) == 1
 
diff --git a/lib/spack/spack/util/path.py b/lib/spack/spack/util/path.py
index 25b397f..39074f8 100644
--- a/lib/spack/spack/util/path.py
+++ b/lib/spack/spack/util/path.py
@@ -64,9 +64,13 @@ def replacements():
     arch = architecture()
 
     return {
-        "spack": lambda: spack.paths.prefix,
+        "spack": lambda: spack.paths.prefix if \
+            spack.paths.prefix != "/" else "",
         "user": lambda: get_user(),
         "tempdir": lambda: tempfile.gettempdir(),
+        "share": lambda: os.path.join(
+            spack.paths.prefix if \
+            spack.paths.prefix != "/"  else "/usr", "share"),
         "user_cache_path": lambda: spack.paths.user_cache_path,
         "architecture": lambda: arch,
         "arch": lambda: arch,