fzf: add v0.60.0, improve styling (#49059)

This commit is contained in:
Alec Scott 2025-02-16 09:13:53 -08:00 committed by GitHub
parent 7e65c57861
commit 6d35a75c4f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,23 +1,31 @@
# Copyright Spack Project Developers. See COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import re
from spack.package import *
class Fzf(MakefilePackage):
"""fzf is a general-purpose command-line fuzzy finder."""
"""A general-purpose command-line fuzzy finder that provides fast, interactive
filtering for files, processes, git commits, and more. It supports fuzzy
search with real-time preview and various input sources."""
homepage = "https://github.com/junegunn/fzf"
url = "https://github.com/junegunn/fzf/archive/v0.54.0.tar.gz"
git = "https://github.com/junegunn/fzf.git"
maintainers("alecbcs")
executables = ["^fzf$"]
license("MIT")
sanity_check_is_file = ["bin/fzf"]
sanity_check_is_dir = ["share/fzf/shell"]
# Versions from newest to oldest
version("master", branch="master")
version("0.60.0", sha256="69255fd9301e491b6ac6788bf1caf5d4f70d9209b4b8ab70ceb1caf6a69b5c16")
version("0.57.0", sha256="d4e8e25fad2d3f75943b403c40b61326db74b705bf629c279978fdd0ceb1f97c")
version("0.56.2", sha256="1d67edb3e3ffbb14fcbf786bfcc0b5b8d87db6a0685135677b8ef4c114d2b864")
version("0.55.0", sha256="805383f71bca7f8fb271ecd716852aea88fd898d5027d58add9e43df6ea766da")
@ -33,39 +41,49 @@ class Fzf(MakefilePackage):
version("0.41.1", sha256="982682eaac377c8a55ae8d7491fcd0e888d6c13915d01da9ebb6b7c434d7f4b5")
version("0.40.0", sha256="9597f297a6811d300f619fff5aadab8003adbcc1566199a43886d2ea09109a65")
depends_on("go@1.17:", type="build")
depends_on("go@1.20:", type="build", when="@0.49.0:")
# Variants
variant("vim", default=False, description="Install vim plugins for fzf")
# Build dependencies
depends_on("go@1.20:", type="build", when="@0.49.0:")
depends_on("go@1.17:", type="build")
executables = ["^fzf$"]
@classmethod
def determine_version(cls, exe):
"""Determine version of installed fzf executable."""
output = Executable(exe)("--version", output=str, error=str)
match = re.match(r"(^[\d.]+)", output)
return match.group(1) if match else None
def url_for_version(self, version):
"""Generate download URL for a specific version."""
base = "refs/tags/v" if self.spec.satisfies("@:0.53.0") else ""
return f"https://github.com/junegunn/fzf/archive/{base}{version}.tar.gz"
def setup_build_environment(self, env):
# Point GOPATH at the top of the staging dir for the build step.
"""Set up the build environment for fzf."""
# Point GOPATH at the top of the staging dir for the build step
env.prepend_path("GOPATH", self.stage.path)
# Set required environment variables since we
# are not using git to pull down the repository.
# Set required environment variables for non-git builds
env.set("FZF_VERSION", self.spec.version)
env.set("FZF_REVISION", "tarball")
def install(self, spec, prefix):
"""Install fzf and its components."""
make("install")
# Install binary
mkdir(prefix.bin)
install("bin/fzf", prefix.bin)
# Install shell integration scripts
mkdirp(prefix.share.fzf.shell)
install_tree("shell", prefix.share.fzf.shell)
# Install vim plugin if requested
if spec.satisfies("+vim"):
mkdirp(prefix.share.fzf.plugins)
install("plugin/fzf.vim", prefix.share.fzf.plugins)