summaryrefslogtreecommitdiff
path: root/var
diff options
context:
space:
mode:
authorAlec Scott <hi@alecbcs.com>2024-10-02 05:23:13 -0700
committerGitHub <noreply@github.com>2024-10-02 06:23:13 -0600
commitdcdc678b19def86b584182bcde47cf8858617e31 (patch)
tree2426aa081dca3cf77701632523396c8b1016072d /var
parent8e3e7a5541aea3c510cb9380a8a5e6488aabdec5 (diff)
downloadspack-dcdc678b19def86b584182bcde47cf8858617e31.tar.gz
spack-dcdc678b19def86b584182bcde47cf8858617e31.tar.bz2
spack-dcdc678b19def86b584182bcde47cf8858617e31.tar.xz
spack-dcdc678b19def86b584182bcde47cf8858617e31.zip
GoPackage: fix attributes to allow for custom build_directory values (#46707)
Diffstat (limited to 'var')
-rw-r--r--var/spack/repos/builtin/packages/glab/package.py25
1 files changed, 15 insertions, 10 deletions
diff --git a/var/spack/repos/builtin/packages/glab/package.py b/var/spack/repos/builtin/packages/glab/package.py
index 0d2dd6b458..58ed827e1f 100644
--- a/var/spack/repos/builtin/packages/glab/package.py
+++ b/var/spack/repos/builtin/packages/glab/package.py
@@ -6,7 +6,7 @@
from spack.package import *
-class Glab(Package):
+class Glab(GoPackage):
"""GitLab's official command line tool."""
homepage = "https://gitlab.com/gitlab-org/cli"
@@ -41,15 +41,20 @@ class Glab(Package):
depends_on("go@1.22.5:", type="build", when="@1.44:")
depends_on("go@1.23:", type="build", when="@1.46:")
- phases = ["build", "install"]
+ build_directory = "cmd/glab"
- def setup_build_environment(self, env):
- # Point GOPATH at the top of the staging dir for the build step.
- env.prepend_path("GOPATH", self.stage.path)
+ @run_after("install")
+ def install_completions(self):
+ glab = Executable(self.prefix.bin.glab)
- def build(self, spec, prefix):
- make()
+ mkdirp(bash_completion_path(self.prefix))
+ with open(bash_completion_path(self.prefix) / "glab", "w") as file:
+ glab("completion", "-s", "bash", output=file)
- def install(self, spec, prefix):
- mkdirp(prefix.bin)
- install("bin/glab", prefix.bin)
+ mkdirp(fish_completion_path(self.prefix))
+ with open(fish_completion_path(self.prefix) / "glab.fish", "w") as file:
+ glab("completion", "-s", "fish", output=file)
+
+ mkdirp(zsh_completion_path(self.prefix))
+ with open(zsh_completion_path(self.prefix) / "_glab", "w") as file:
+ glab("completion", "-s", "zsh", output=file)