From 66ed8ebbd9154eba42917a6f22923009089d1ebe Mon Sep 17 00:00:00 2001 From: Wouter Deconinck Date: Tue, 23 Jul 2024 11:49:05 -0400 Subject: [PATCH] gh: convert to GoPackage (#45351) * gh: convert to GoPackage * gh: fix style --- var/spack/repos/builtin/packages/gh/package.py | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/var/spack/repos/builtin/packages/gh/package.py b/var/spack/repos/builtin/packages/gh/package.py index ca768b4eb02..90f40c63138 100644 --- a/var/spack/repos/builtin/packages/gh/package.py +++ b/var/spack/repos/builtin/packages/gh/package.py @@ -6,7 +6,7 @@ from spack.package import * -class Gh(Package): +class Gh(GoPackage): """GitHub's official command line tool.""" homepage = "https://github.com/cli/cli" @@ -43,14 +43,10 @@ class Gh(Package): depends_on("go@1.21:", type="build", when="@2.33.0:") depends_on("go@1.22:", type="build", when="@2.47.0:") - phases = ["build", "install"] - 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) - - def build(self, spec, prefix): - make() - - def install(self, spec, prefix): - make("install", "prefix=" + prefix) +class GoBuilder(spack.build_systems.go.GoBuilder): + @property + def build_args(self): + args = super().build_args + args.extend(["-trimpath", "./cmd/gh"]) + return args