Initial commit

This commit is contained in:
2026-06-17 14:01:36 +04:00
commit 4a8191c9a8
23 changed files with 3199 additions and 0 deletions
+33
View File
@@ -0,0 +1,33 @@
# frozen_string_literal: true
# Generated by generate_tap.py for local/mirror
cask "android-platform-tools" do
os macos: "darwin", linux: "linux"
version "37.0.0"
sha256 arm: "094a1395683c509fd4d48667da0d8b5ef4d42b2abfcd29f2e8149e2f989357c7",
x86_64: "094a1395683c509fd4d48667da0d8b5ef4d42b2abfcd29f2e8149e2f989357c7",
x86_64_linux: "198ae156ab285fa555987219af237b31102fefe8b9d2bc274708a8d4f2865a07",
arm64_linux: "198ae156ab285fa555987219af237b31102fefe8b9d2bc274708a8d4f2865a07"
url "https://homebrew.mirror.ygg/casks/android-platform-tools/android-platform-tools--platform-tools_r37.0.0-darwin.zip",
verified: "google.com/android/repository/"
name "Android SDK Platform-Tools"
desc "Android SDK component"
homepage "https://developer.android.com/tools/releases/platform-tools"
livecheck do
url :homepage
regex(/data-text=["']?[^"' >]*?v?(\d+(?:\.\d+)+)["'> (]/i)
end
binary "#{staged_path}/platform-tools/adb"
binary "#{staged_path}/platform-tools/etc1tool"
binary "#{staged_path}/platform-tools/fastboot"
binary "#{staged_path}/platform-tools/hprof-conv"
binary "#{staged_path}/platform-tools/make_f2fs"
binary "#{staged_path}/platform-tools/make_f2fs_casefold"
binary "#{staged_path}/platform-tools/mke2fs"
# No zap stanza required
end
+37
View File
@@ -0,0 +1,37 @@
# frozen_string_literal: true
# Generated by generate_tap.py for local/mirror
cask "claude-code" do
arch arm: "arm64", intel: "x64"
os macos: "darwin", linux: "linux"
version "2.1.169"
sha256 arm: "86d8b820ad7eed50e50a130706d3dc5ef70696f91194de1b3897a842182afe3a",
x86_64: "6d8d510c715b899307b7d29a1062d43e62c99370c55330dac3ec1851a2fbf7c8",
arm64_linux: "341072395844b2b6d2846d8d61d551752b12a44433c920d0cc7fe6e7b5692a9b",
x86_64_linux: "cf066bf360cbf7b51abeb8cb230012fc0f2fed4253b2ce305de48ccd6d49a39c"
url "https://homebrew.mirror.ygg/casks/claude-code/claude-code--claude",
verified: "downloads.claude.ai/claude-code-releases/"
name "Claude Code"
desc "Terminal-based AI coding assistant"
homepage "https://claude.com/product/claude-code"
livecheck do
url "https://downloads.claude.ai/claude-code-releases/stable"
regex(/^v?(\d+(?:\.\d+)+)$/i)
end
binary "claude"
zap trash: [
"~/.cache/claude",
"~/.claude.json*",
"~/.config/claude",
"~/.local/bin/claude",
"~/.local/share/claude",
"~/.local/state/claude",
"~/Library/Caches/claude-cli-nodejs",
],
rmdir: "~/.claude"
end
+32
View File
@@ -0,0 +1,32 @@
# frozen_string_literal: true
# Generated by generate_tap.py for local/mirror
cask "codex" do
arch arm: "aarch64", intel: "x86_64"
os macos: "apple-darwin", linux: "unknown-linux-musl"
version "0.140.0"
sha256 arm: "c81eaf1b4c9aee0e81e2b39dec1742a57b61be6c109f8811e7fcd41f55c2233d",
intel: "2bd0edf75fd1451425736bae41470c3b800fe8eb372c194a668434f9526df9f0",
arm64_linux: "ec6c804d415e42dd28cc6f8c6cb5238b00c9af4bfb58b63be55e26ec4ee576c0",
x86_64_linux: "48e591964d4bbaab7c0433daed41c65ea8f152fc0f1dd2334a42e3dd322a4906"
url "https://homebrew.mirror.ygg/casks/codex/codex--codex-aarch64-apple-darwin.tar.gz"
name "Codex"
desc "OpenAI's coding agent that runs in your terminal"
homepage "https://github.com/openai/codex"
livecheck do
url :url
regex(/^rust-v?(\d+(?:\.\d+)+)$/i)
strategy :github_latest
end
depends_on formula: "ripgrep"
binary "codex-#{arch}-#{os}", target: "codex"
generate_completions_from_executable "codex-#{arch}-#{os}", "completion", base_name: "codex"
zap rmdir: "~/.codex"
end
+46
View File
@@ -0,0 +1,46 @@
# frozen_string_literal: true
# Generated by generate_tap.py for local/mirror
class Atuin < Formula
desc "Improved shell history for zsh, bash, fish and nushell"
homepage "https://atuin.sh/"
url "https://homebrew.mirror.ygg/sources/358c49594fdce992e276d27a0f8f2aab40f671f9f089f772331aa6d40cdde689--atuin--18.16.1.x86_64_linux.bottle.1.tar.gz"
sha256 "aec5c91207f080becc4b13593d5b7edc46685e8d4dbfbaef33d31f8058191bc6"
license "MIT"
head "https://github.com/atuinsh/atuin.git", branch: "main"
bottle do
root_url "https://homebrew.mirror.ygg/bottles"
rebuild 1
sha256 cellar: :any_skip_relocation, arm64_tahoe: "7c0a9028714c42a158eedafd0e3c616f1e6df335f5e2fe3d4796006d8996d5db"
sha256 cellar: :any_skip_relocation, arm64_sequoia: "aabe5a89f5f07effa9b1d93087469c60e3630bbb1f1eef4b4f3e8e63b8c1790b"
sha256 cellar: :any_skip_relocation, arm64_sonoma: "409a9e05765cda4f7271eaaa7833afb7d5ad55b71badac5b6459aa78cb85ee0e"
sha256 cellar: :any_skip_relocation, sonoma: "ebb8239444b8ce96d114812593e5781d141406097b8348bcf0d5b5ab11619fd0"
sha256 cellar: :any_skip_relocation, arm64_linux: "5edbd418eb0f9d32dedfa1c737e8e66487dd2bc81f02d31d27a807070dc6c7af"
sha256 cellar: :any_skip_relocation, x86_64_linux: "51817c931148502c0ba47dbdb24359642c402c5d1697765a482489a5eb8955d6"
end
depends_on "protobuf" => :build
depends_on "rust" => :build
def install
system "cargo", "install", *std_cargo_args(path: "crates/atuin")
generate_completions_from_executable(bin/"atuin", "gen-completion", "--shell",
shells: [:bash, :zsh, :fish, :pwsh])
end
service do
run [opt_bin/"atuin", "daemon", "start"]
keep_alive true
log_path var/"log/atuin.log"
error_log_path var/"log/atuin.log"
end
test do
# or `atuin init zsh` to setup the `ATUIN_SESSION`
ENV["ATUIN_SESSION"] = "random"
assert_match "autoload -U add-zsh-hook", shell_output("#{bin}/atuin init zsh")
assert shell_output("#{bin}/atuin history list").blank?
end
end
+64
View File
@@ -0,0 +1,64 @@
# frozen_string_literal: true
# Generated by generate_tap.py for local/mirror
class ClangFormat < Formula
desc "Formatting tools for C, C++, Obj-C, Java, JavaScript, TypeScript"
homepage "https://clang.llvm.org/docs/ClangFormat.html"
url "https://homebrew.mirror.ygg/sources/c01ebc051b7d6beb690739b66d16f80c2fdd025a38ade481c57108f884e57603--clang-format--22.1.8.x86_64_linux.bottle.tar.gz"
sha256 "922f1817a0df7b1489272d18134ee0087a8b068828f87ac63b9861b1a9965888"
# The LLVM Project is under the Apache License v2.0 with LLVM Exceptions
license "Apache-2.0" => { with: "LLVM-exception" }
version_scheme 1
head "https://github.com/llvm/llvm-project.git", branch: "main"
livecheck do
url :stable
regex(/llvmorg[._-]v?(\d+(?:\.\d+)+)/i)
strategy :github_latest
end
bottle do
root_url "https://homebrew.mirror.ygg/bottles"
sha256 cellar: :any_skip_relocation, arm64_tahoe: "e20d0dbbf9f69f0867b35266ec5c64e2483d2ec9a5275cfe1ae2781cfeb5ad75"
sha256 cellar: :any_skip_relocation, arm64_sequoia: "7f943e52e18ec8cfda8ab3174eb733017600af529203e53a3a49443044656f46"
sha256 cellar: :any_skip_relocation, arm64_sonoma: "33059fc48804586223ece39cdafba74d6ec600ac792e3bd65c031f760278435b"
sha256 cellar: :any_skip_relocation, sonoma: "a8dd7c9efe79e3f69b901ea1e7e3fbd0aaa4ee887e76e13bf38ab8f22058ab49"
sha256 cellar: :any, arm64_linux: "8f77d7106b7b5af26a131022ec91b1b926d6fad7fb7abb4aa322e7e3a8300b38"
sha256 cellar: :any, x86_64_linux: "442dd96bb8ecbc6a01c8c7245ecba01567511b0626dba79a349854a68897fc2f"
end
depends_on "cmake" => :build
uses_from_macos "python"
on_linux do
keg_only "it conflicts with llvm"
end
def install
system "cmake", "-S", "llvm", "-B", "build",
"-DLLVM_ENABLE_PROJECTS=clang",
"-DLLVM_INCLUDE_BENCHMARKS=OFF",
*std_cmake_args
system "cmake", "--build", "build", "--target", "clang-format"
system "cmake", "--install", "build", "--component", "clang-format"
end
test do
system "git", "init"
system "git", "commit", "--allow-empty", "-m", "initial commit", "--quiet"
# NB: below C code is messily formatted on purpose.
(testpath/"test.c").write <<~C
int main(char *args) { \n \t printf("hello"); }
C
system "git", "add", "test.c"
assert_equal <<~C, shell_output("#{bin}/clang-format -style=Google test.c")
int main(char* args) { printf("hello"); }
C
ENV.prepend_path "PATH", bin
assert_match "test.c", shell_output("git clang-format", 1)
end
end
+60
View File
@@ -0,0 +1,60 @@
# frozen_string_literal: true
# Generated by generate_tap.py for local/mirror
class DockerCompose < Formula
desc "Isolated development environments using Docker"
homepage "https://docs.docker.com/compose/"
url "https://homebrew.mirror.ygg/sources/16f5e2ba5d2056f7cdd2d4fcc9e5a7bb7430cb3fdf0fd50827f7d55a36a0097b--docker-compose--5.1.4.x86_64_linux.bottle.tar.gz"
sha256 "363ce6ccca46f836648f5f4ec9ecfdb6f631daa126570cc3fc69140edeed6794"
license "Apache-2.0"
head "https://github.com/docker/compose.git", branch: "main"
# Upstream creates releases that use a stable tag (e.g., `v1.2.3`) but are
# labeled as "pre-release" on GitHub before the version is released, so it's
# necessary to use the `GithubLatest` strategy.
livecheck do
url :stable
strategy :github_latest
end
bottle do
root_url "https://homebrew.mirror.ygg/bottles"
sha256 cellar: :any_skip_relocation, arm64_tahoe: "0f168e11e7152a10266336d79e1b3bff13fd7334a41f654d30e55a714b3dde6e"
sha256 cellar: :any_skip_relocation, arm64_sequoia: "a2b182b7cd39c4309112627c7014253aeef19a934f1876c68c1d19419dcb25cc"
sha256 cellar: :any_skip_relocation, arm64_sonoma: "e53db8ef5a47a6931a97ea1610314f425b9a7abda371f6dc9307d868972ffe66"
sha256 cellar: :any_skip_relocation, sonoma: "54dfb611519db44e990d5a8113c5e746a95d874efca6f1909b0c16a4ff256b64"
sha256 cellar: :any_skip_relocation, arm64_linux: "1db0df21e2c8fbe0408dd96feac03ef8400651cf2fcf5bb8a884348e81ecdafc"
sha256 cellar: :any_skip_relocation, x86_64_linux: "7434d8e07ab042d1973d69a3a568530fcd3f2f4d8a4a3fcb64eb43c50d0d8730"
end
depends_on "go" => :build
conflicts_with cask: "docker-desktop"
def install
ENV["CGO_ENABLED"] = OS.mac? ? "1" : "0"
ldflags = %W[
-s -w
-X github.com/docker/compose/v#{version.major}/internal.Version=#{version}
]
tags = %w[fsnotify] if OS.mac?
system "go", "build", *std_go_args(ldflags:, tags:), "./cmd"
(lib/"docker/cli-plugins").install_symlink bin/"docker-compose"
end
def caveats
<<~EOS
Compose is a Docker plugin. For Docker to find the plugin, add "cliPluginsExtraDirs" to ~/.docker/config.json:
"cliPluginsExtraDirs": [
"#{HOMEBREW_PREFIX}/lib/docker/cli-plugins"
]
EOS
end
test do
output = shell_output("#{bin}/docker-compose up 2>&1", 1)
assert_match "no configuration file provided", output
assert_match version.to_s, shell_output("#{bin}/docker-compose version")
end
end
+45
View File
@@ -0,0 +1,45 @@
# frozen_string_literal: true
# Generated by generate_tap.py for local/mirror
class Helm < Formula
desc "Kubernetes package manager"
homepage "https://helm.sh/"
url "https://homebrew.mirror.ygg/sources/7a435808b5b1e80724b1b5af6619dc6a78044f98000f016bc764e927c3b4b56f--helm--4.2.1.x86_64_linux.bottle.tar.gz",
tag: "v4.2.1",
revision: "d591a19b953bd9cfdf7d9ddd83c2f4ffdaeafb29"
license "Apache-2.0"
head "https://github.com/helm/helm.git", branch: "main"
bottle do
root_url "https://homebrew.mirror.ygg/bottles"
sha256 cellar: :any_skip_relocation, arm64_tahoe: "5c4337a164b678cb91a5c41a6e123a5655da61d327949056a9b52b55be2b22b0"
sha256 cellar: :any_skip_relocation, arm64_sequoia: "0d5b93d1e2551e65e5a7df11141e15885554c50c1aa62a8cea76fc9a835a9a0b"
sha256 cellar: :any_skip_relocation, arm64_sonoma: "8b435cad933fde8b3737b029fdf7486a325091e57ae3a600edf477dbed4e8167"
sha256 cellar: :any_skip_relocation, sonoma: "5ee83e533d86a2d728fd27cd2413dd09fa4e140f9cee206eeda908667d159940"
sha256 cellar: :any_skip_relocation, arm64_linux: "ae9d6781dee7049fb57dfbf77a5f34cd9f1dc6096e78a7b19eec6602999a0c99"
sha256 cellar: :any_skip_relocation, x86_64_linux: "4c1090d8f8f4cabf2840bcf0b1259831e9b72d3677ec460a7e9b8317dd28b7f6"
end
depends_on "go" => :build
def install
system "make", "build"
bin.install "bin/helm"
mkdir "man1" do
system bin/"helm", "docs", "--type", "man"
man1.install Dir["*"]
end
generate_completions_from_executable(bin/"helm", shell_parameter_format: :cobra)
end
test do
system bin/"helm", "create", "foo"
assert File.directory? testpath/"foo/charts"
version_output = shell_output("#{bin}/helm version 2>&1")
assert_match "GitCommit:\"#{stable.specs[:revision]}\"", version_output
assert_match "Version:\"v#{version}\"", version_output
end
end
+57
View File
@@ -0,0 +1,57 @@
# frozen_string_literal: true
# Generated by generate_tap.py for local/mirror
class KubernetesCli < Formula
desc "Kubernetes command-line interface"
homepage "https://kubernetes.io/docs/reference/kubectl/"
url "https://homebrew.mirror.ygg/sources/7902f16cb564f74289964e1bf0f989e6f395847ea9badb9d0fda9468a692a4ad--kubernetes-cli--1.36.2.x86_64_linux.bottle.tar.gz",
tag: "v1.36.2",
revision: "24e2b02af5543d7910c2bb074c7264df5a8f0467"
license "Apache-2.0"
head "https://github.com/kubernetes/kubernetes.git", branch: "master"
livecheck do
url :stable
regex(/^v?(\d+(?:\.\d+)+)$/i)
end
bottle do
root_url "https://homebrew.mirror.ygg/bottles"
sha256 cellar: :any_skip_relocation, arm64_tahoe: "91df548e1cb396ef67e3a99aa2832777e7ebcd56e0b8050a981a9dc8f1234002"
sha256 cellar: :any_skip_relocation, arm64_sequoia: "8cf9ef220adef51db3f6835f0b4c7fe0b322f593c668753e5635566520ed06c2"
sha256 cellar: :any_skip_relocation, arm64_sonoma: "5ca5116967ba01c8abc7c03019bfc2bc6599efefe6aca4dc2a913939ecfb9082"
sha256 cellar: :any_skip_relocation, sonoma: "9c4452b0a565b7687f2c374802d19c794b2c192db0ab1da264052e9c8a5cdc11"
sha256 cellar: :any_skip_relocation, arm64_linux: "ee8cd75eacc68081c0a08b4d038c5f61fb08d16ae45574e07c870c12ad116661"
sha256 cellar: :any_skip_relocation, x86_64_linux: "85ab53660f7b8edd92dc7e851191a8474ac8bc19f6281f8f0e02a4c777d494ea"
end
depends_on "go" => :build
on_macos do
depends_on "bash" => :build
depends_on "coreutils" => :build
end
def install
ENV.prepend_path "PATH", Formula["coreutils"].libexec/"gnubin" if OS.mac? # needs GNU date
ENV["FORCE_HOST_GO"] = "1"
system "make", "WHAT=cmd/kubectl"
bin.install "_output/bin/kubectl"
generate_completions_from_executable(bin/"kubectl", shell_parameter_format: :cobra)
# Install man pages
# Leave this step for the end as this dirties the git tree
system "hack/update-generated-docs.sh"
man1.install Dir["docs/man/man1/*.1"]
end
test do
run_output = shell_output("#{bin}/kubectl 2>&1")
assert_match "kubectl controls the Kubernetes cluster manager.", run_output
version_output = shell_output("#{bin}/kubectl version --client --output=yaml 2>&1")
assert_match "gitTreeState: clean", version_output
assert_match stable.specs[:revision].to_s, version_output
end
end
+40
View File
@@ -0,0 +1,40 @@
# frozen_string_literal: true
# Generated by generate_tap.py for local/mirror
class Mactop < Formula
desc "Apple Silicon Monitor Top written in Go Lang"
homepage "https://github.com/metaspartan/mactop"
url "https://homebrew.mirror.ygg/sources/98986a2c2d16f785a8f5381537a5c4aa494d4cfabdd8d44a5babf5346d0be9d1--mactop-2.1.5.tar.gz"
sha256 "df49979c413b8a3a6e98ccfb553fafeb94fd652ec13a830205d057c8d73cace7"
license "MIT"
head "https://github.com/metaspartan/mactop.git", branch: "main"
bottle do
root_url "https://homebrew.mirror.ygg/bottles"
sha256 cellar: :any_skip_relocation, arm64_tahoe: "2cd8bcc67340c0f637d6345b0a6b3ca729e6237f6e322e0d90e7bd48a8580a2f"
sha256 cellar: :any_skip_relocation, arm64_sequoia: "a022ad6a6b766891a69ee8ab26956fb0dfe5b163cb7eaefa6032ee2f9f587cfb"
sha256 cellar: :any_skip_relocation, arm64_sonoma: "c97420c5a27f470fc56fda4640f08f9dccfc3c45cecda6437ac12c2efa0f7f60"
end
depends_on "go" => :build
depends_on arch: :arm64
depends_on :macos
def install
system "go", "build", *std_go_args(ldflags: "-s -w")
end
service do
run [opt_bin/"mactop", "-p", "9101", "--headless"]
keep_alive true
log_path var/"log/mactop.log"
error_log_path var/"log/mactop.error.log"
process_type :background
nice 10
end
test do
test_input = "This is a test input for brew"
assert_match "Test input received: #{test_input}", shell_output("#{bin}/mactop --test '#{test_input}'")
end
end
+59
View File
@@ -0,0 +1,59 @@
# frozen_string_literal: true
# Generated by generate_tap.py for local/mirror
class Ncdu < Formula
desc "NCurses Disk Usage"
homepage "https://dev.yorhel.nl/ncdu"
url "https://homebrew.mirror.ygg/sources/023b45ac32cdd77be32bff75872f4d8e4bcacc6926f1af6cbc8d6e51563d2fe4--ncdu--2.9.2.x86_64_linux.bottle.tar.gz"
sha256 "e91135281cb66569f2ca4c0bac277246991e7e52524c0ca8cba3de5c8e81cec9"
license "MIT"
head "https://g.blicky.net/ncdu.git", branch: "zig"
livecheck do
url :homepage
regex(/href=.*?ncdu[._-]v?(\d+(?:\.\d+)+)\.t/i)
end
bottle do
root_url "https://homebrew.mirror.ygg/bottles"
sha256 cellar: :any, arm64_tahoe: "9a08dd709b18d87d90b016b8685d56f2de8d537e437ab44cf4ed92203df7a245"
sha256 cellar: :any, arm64_sequoia: "d56b0ffa80c15fa5758a8b7b59525687a1a04ce043d540936b6db917c7c14c30"
sha256 cellar: :any, arm64_sonoma: "b86c878b672bb5a7d8644e9908c4ed1ca3fd942095becec43ceff480340d2a2b"
sha256 cellar: :any, sonoma: "768ace20bc54c22b86ddce63d51bd8488cb04816e28e330286a2685047d5484e"
sha256 cellar: :any_skip_relocation, arm64_linux: "2a2d143126f866ae7a7f0aeecc2d12282bde98542e1ece1203d821a8d499343b"
sha256 cellar: :any_skip_relocation, x86_64_linux: "762c13f508d0699c363f0a3a0741a19cbd14d1ef8a86fdd1d70aeaaf2f7bd851"
end
depends_on "pkgconf" => :build
depends_on "zig@0.15" => :build
# Without this, `ncdu` is unusable when `TERM=tmux-256color`.
depends_on "ncurses"
depends_on "zstd"
def install
args = []
args << "-Dpie=true" if OS.mac?
# Workaround for https://github.com/Homebrew/homebrew-core/pull/141453#discussion_r1320821081
# Remove this workaround when the same is removed in `zig.rb`.
if OS.linux?
ENV["NIX_LDFLAGS"] = ENV["HOMEBREW_RPATH_PATHS"].split(":")
.map { |p| "-rpath #{p}" }
.join(" ")
end
# Avoid the Makefile for now so that we can pass `-Dcpu` to `zig build`.
# https://code.blicky.net/yorhel/ncdu/issues/185
system "zig", "build", *args, *std_zig_args
man1.install "ncdu.1"
end
test do
assert_match version.to_s, shell_output("#{bin}/ncdu -v")
system bin/"ncdu", "-o", "test"
output = JSON.parse((testpath/"test").read)
assert_equal "ncdu", output[2]["progname"]
assert_equal version.to_s, output[2]["progver"]
assert_equal Pathname.pwd.size, output[3][0]["asize"]
end
end
+177
View File
@@ -0,0 +1,177 @@
# frozen_string_literal: true
# Generated by generate_tap.py for local/mirror
class Neovim < Formula
desc "Ambitious Vim-fork focused on extensibility and agility"
homepage "https://neovim.io/"
license "Apache-2.0"
compatibility_version 1
head "https://github.com/neovim/neovim.git", branch: "master"
stable do
url "https://homebrew.mirror.ygg/sources/d8665733f86fc2a47171eaae9b1bf690d8927e4b61d2b03c086bec20f3c22ab3--neovim--0.12.3.x86_64_linux.bottle.tar.gz"
sha256 "36a6c66bfbba5d96fa512110aecddb981148a4d013b5ecd01a42877c49855a41"
# Keep resources updated according to:
# https://github.com/neovim/neovim/blob/v#{version}/cmake.deps/deps.txt
# TODO: Consider shipping these as separate formulae instead. See discussion at
# https://github.com/orgs/Homebrew/discussions/3611
# NOTE: The `install` method assumes that the parser name follows the final `-`.
# Please name the resources accordingly.
resource "tree-sitter-c" do
url "https://github.com/tree-sitter/tree-sitter-c/archive/refs/tags/v0.24.1.tar.gz"
sha256 "25dd4bb3dec770769a407e0fc803f424ce02c494a56ce95fedc525316dcf9b48"
livecheck do
url "https://raw.githubusercontent.com/neovim/neovim/refs/tags/v#{LATEST_VERSION}/cmake.deps/deps.txt"
regex(%r{https://github\.com/tree-sitter/tree-sitter-c/archive/v?(\d+(?:\.\d+)+)\.tar\.gz}i)
end
end
resource "tree-sitter-lua" do
url "https://github.com/tree-sitter-grammars/tree-sitter-lua/archive/refs/tags/v0.5.0.tar.gz"
sha256 "cf01b93f4b61b96a6d27942cf28eeda4cbce7d503c3bef773a8930b3d778a2d9"
livecheck do
url "https://raw.githubusercontent.com/neovim/neovim/refs/tags/v#{LATEST_VERSION}/cmake.deps/deps.txt"
regex(%r{https://github\.com/tree-sitter-grammars/tree-sitter-lua/archive/v?(\d+(?:\.\d+)+)\.tar\.gz}i)
end
end
resource "tree-sitter-vim" do
url "https://github.com/tree-sitter-grammars/tree-sitter-vim/archive/refs/tags/v0.8.1.tar.gz"
sha256 "93cafb9a0269420362454ace725a118ff1c3e08dcdfdc228aa86334b54d53c2a"
livecheck do
url "https://raw.githubusercontent.com/neovim/neovim/refs/tags/v#{LATEST_VERSION}/cmake.deps/deps.txt"
regex(%r{https://github\.com/tree-sitter-grammars/tree-sitter-vim/archive/v?(\d+(?:\.\d+)+)\.tar\.gz}i)
end
end
resource "tree-sitter-vimdoc" do
url "https://github.com/neovim/tree-sitter-vimdoc/archive/refs/tags/v4.1.0.tar.gz"
sha256 "020e8f117f648c8697fca967995c342e92dbd81dab137a115cc7555207fbc84f"
livecheck do
url "https://raw.githubusercontent.com/neovim/neovim/refs/tags/v#{LATEST_VERSION}/cmake.deps/deps.txt"
regex(%r{https://github\.com/neovim/tree-sitter-vimdoc/archive/v?(\d+(?:\.\d+)+)\.tar\.gz}i)
end
end
resource "tree-sitter-query" do
url "https://github.com/tree-sitter-grammars/tree-sitter-query/archive/refs/tags/v0.8.0.tar.gz"
sha256 "c2b23b9a54cffcc999ded4a5d3949daf338bebb7945dece229f832332e6e6a7d"
livecheck do
url "https://raw.githubusercontent.com/neovim/neovim/refs/tags/v#{LATEST_VERSION}/cmake.deps/deps.txt"
regex(%r{https://github\.com/tree-sitter-grammars/tree-sitter-query/archive/v?(\d+(?:\.\d+)+)\.tar\.gz}i)
end
end
resource "tree-sitter-markdown" do
url "https://github.com/tree-sitter-grammars/tree-sitter-markdown/archive/refs/tags/v0.5.3.tar.gz"
sha256 "df845b1ab7c7c163ec57d7fa17170c92b04be199bddab02523636efec5224ab6"
livecheck do
url "https://raw.githubusercontent.com/neovim/neovim/refs/tags/v#{LATEST_VERSION}/cmake.deps/deps.txt"
regex(%r{https://github\.com/tree-sitter-grammars/tree-sitter-markdown/archive/v?(\d+(?:\.\d+)+)\.tar\.gz}i)
end
end
end
livecheck do
url :stable
regex(/^v?(\d+(?:\.\d+)+)$/i)
end
bottle do
root_url "https://homebrew.mirror.ygg/bottles"
sha256 arm64_tahoe: "c6afc7ce2d91a302dd5945ac1699e32a72bd6122de9e101d32484eafb358414b"
sha256 arm64_sequoia: "4f346d05ead887cfc11e6531cc8fabf39c95fb3ee47809524f5a547489854e5e"
sha256 arm64_sonoma: "ad3f08b6ea7c78a92fe187d6aec7e6be7a32b7958bf63555abbda7bbf57d6976"
sha256 sonoma: "b9df347458b8c059c94576f422225e9dc950ae580cd08bfe6f1d55611ebf2d89"
sha256 arm64_linux: "5cfafd456ed6fb8d4dfe2a797cc5467f5ed6622be1d87fb7ff789ab7d095dce0"
sha256 x86_64_linux: "7f7b6c58f93f8a9916c6990ca77ae84b72424ff7afb3ce53d42da34154070f64"
end
depends_on "cmake" => :build
depends_on "gettext" => :build
depends_on "libuv"
depends_on "lpeg"
depends_on "luajit"
depends_on "luv"
depends_on "tree-sitter"
depends_on "unibilium"
depends_on "utf8proc"
on_macos do
depends_on "gettext"
end
def install
if build.head?
cmake_deps = (buildpath/"cmake.deps/deps.txt").read.lines
cmake_deps.each do |line|
next unless line.match?(/TREESITTER_[^_]+_URL/)
parser, parser_url = line.split
parser_name = parser.delete_suffix("_URL")
parser_sha256 = cmake_deps.find { |l| l.include?("#{parser_name}_SHA256") }.split.last
parser_name = parser_name.downcase.tr("_", "-")
resource parser_name do
url parser_url
sha256 parser_sha256
end
end
end
resources.each do |r|
source_directory = buildpath/"deps-build/build/src"/r.name
build_directory = buildpath/"deps-build/build"/r.name
parser_name = r.name.split("-").last
cmakelists = case parser_name
when "markdown" then "MarkdownParserCMakeLists.txt"
else "TreesitterParserCMakeLists.txt"
end
r.stage(source_directory)
cp buildpath/"cmake.deps/cmake"/cmakelists, source_directory/"CMakeLists.txt"
system "cmake", "-S", source_directory, "-B", build_directory, "-DPARSERLANG=#{parser_name}", *std_cmake_args
system "cmake", "--build", build_directory
system "cmake", "--install", build_directory
end
# Point system locations inside `HOMEBREW_PREFIX`.
inreplace "src/nvim/os/stdpaths.c" do |s|
s.gsub! "/etc/xdg/", "#{etc}/xdg/:\\0"
if HOMEBREW_PREFIX.to_s != HOMEBREW_DEFAULT_PREFIX
s.gsub! "/usr/local/share/:/usr/share/", "#{HOMEBREW_PREFIX}/share/:\\0"
end
end
# Replace `-dirty` suffix in `--version` output with `-Homebrew`.
inreplace "cmake/GenerateVersion.cmake", "--dirty", "--dirty=-Homebrew"
args = [
"-DLUV_LIBRARY=#{Formula["luv"].opt_lib/shared_library("libluv")}",
"-DLIBUV_LIBRARY=#{Formula["libuv"].opt_lib/shared_library("libuv")}",
"-DLPEG_LIBRARY=#{Formula["lpeg"].opt_lib/shared_library("liblpeg")}",
]
system "cmake", "-S", ".", "-B", "build", *args, *std_cmake_args
system "cmake", "--build", "build"
system "cmake", "--install", "build"
end
test do
refute_match "dirty", shell_output("#{bin}/nvim --version")
(testpath/"test.txt").write("Hello World from Vim!!")
system bin/"nvim", "--headless", "-i", "NONE", "-u", "NONE",
"+s/Vim/Neovim/g", "+wq", "test.txt"
assert_equal "Hello World from Neovim!!", (testpath/"test.txt").read.chomp
end
end
+327
View File
@@ -0,0 +1,327 @@
# frozen_string_literal: true
# Generated by generate_tap.py for local/mirror
class Node < Formula
desc "Open-source, cross-platform JavaScript runtime environment"
homepage "https://nodejs.org/"
url "https://homebrew.mirror.ygg/sources/2baaa903740d0cf96896afa224cac7ebb02309b9d5df3a64f8945660b65f6d4f--node--26.3.0.x86_64_linux.bottle.1.tar.gz"
sha256 "319ad5d7d20cc622e55eb75b9f1a2546b77a08bd462b67030d0c89316c2c2349"
license "MIT"
compatibility_version 1
head "https://github.com/nodejs/node.git", branch: "main"
livecheck do
url "https://nodejs.org/dist/"
regex(%r{href=["']?v?(\d+(?:\.\d+)+)/?["' >]}i)
end
bottle do
root_url "https://homebrew.mirror.ygg/bottles"
rebuild 1
sha256 cellar: :any, arm64_tahoe: "b4e808869c4e2e264524f3a54279d942321d96d4a1497c06e02533db0863ad81"
sha256 cellar: :any, arm64_sequoia: "094aa37e3df29929745fb544e90d27fa975a65cc32ab0baf4764f1610777498a"
sha256 cellar: :any, arm64_sonoma: "d641eb32238d9d618926a5b1fde22c09db786fa4f766b262aa4b88d39a4bf64b"
sha256 cellar: :any, sonoma: "b6e58457b021c00f06785efbcfc2226abf718831c4df29615d757a604e46798b"
sha256 cellar: :any, arm64_linux: "298e09c8d546e06422e524ea3fabbc64384bbaaf829debc3d87f449c097af2e1"
sha256 cellar: :any, x86_64_linux: "3f6963fdec1025e7fcb114aeda76fe792827e9f536061772270289c832970d02"
end
depends_on "pkgconf" => :build
depends_on "python@3.14" => :build
depends_on "ada-url"
depends_on "brotli"
depends_on "c-ares"
depends_on "hdrhistogram_c"
depends_on "icu4c@78"
depends_on "libffi" # System `libffi` is missing some definitions used by node
depends_on "libnghttp2"
depends_on "libnghttp3"
depends_on "libngtcp2"
depends_on "libuv"
depends_on "llhttp"
depends_on "merve"
depends_on "nbytes"
depends_on "openssl@3"
depends_on "simdjson"
depends_on "sqlite" # Fails with macOS sqlite.
depends_on "uvwasi"
depends_on "zstd"
uses_from_macos "python"
on_macos do
depends_on "llvm" => :build if DevelopmentTools.clang_build_version <= 1699
end
on_linux do
depends_on "zlib-ng-compat"
end
link_overwrite "bin/npm", "bin/npx"
# https://github.com/swiftlang/llvm-project/commit/078651b6de4b767b91e3e6a51e5df11a06d7bc4f
fails_with :clang do
build 1699
cause "needs SFINAE-friendly std::pointer_traits"
end
# https://github.com/nodejs/node/blob/main/BUILDING.md#supported-toolchains
# https://github.com/ada-url/ada?tab=readme-ov-file#requirements
fails_with :gcc do
version "12"
cause "needs GCC 13 or newer"
end
# We track major/minor from upstream Node releases.
# We will accept *important* npm patch releases when necessary.
resource "npm" do
url "https://registry.npmjs.org/npm/-/npm-11.16.0.tgz"
sha256 "30fc15697c771002878665c29f49dddde9aa8667fa5719854b2f52d3cd19230b"
livecheck do
url "https://raw.githubusercontent.com/nodejs/node/refs/tags/v#{LATEST_VERSION}/deps/npm/package.json"
strategy :json do |json|
json["version"]
end
end
end
deny_network_access! [:build, :postinstall]
def install
# Backport fix for bundled LIEF's bundled spdlog's bundled fmt.
# Should be fixed when new LIEF version with following commit is released and used by node:
# https://github.com/lief-project/LIEF/commit/710637216b1f6f19569002d62e43fca201b9d91c
inreplace "deps/LIEF/third-party/spdlog/include/spdlog/fmt/bundled/format.h",
"#ifndef FMT_MODULE\n# include <cmath>",
"#ifndef FMT_MODULE\n# include <stdlib.h>\n# include <cmath>"
# make sure subprocesses spawned by make are using our Python 3
ENV["PYTHON"] = which("python3.14")
# Ensure Homebrew deps are used
rm_r(["deps/icu-small", "deps/npm"])
# Never install the bundled "npm", always prefer our
# installation from tarball for better packaging control.
args = %W[
--prefix=#{prefix}
--without-npm
--with-intl=system-icu
--shared
--openssl-use-def-ca-store
]
args << "--tag=head" if build.head?
# Devendor libraries available as formulae. The following maps the name
# used in configure (e.g. `--shared-<flag>`) to the bundled subdirectory
# and corresponding formula name as these can all differ.
{
# flag name sub-directory formula name
"ada" => ["ada", "ada-url"],
"brotli" => ["brotli", "brotli"],
"cares" => ["cares", "c-ares"],
"ffi" => ["libffi", "libffi"],
"hdr-histogram" => ["histogram", "hdrhistogram_c"],
"http-parser" => ["llhttp", "llhttp"],
"libuv" => ["uv", "libuv"],
"merve" => ["merve", "merve"],
"nbytes" => ["nbytes", "nbytes"],
"nghttp2" => ["nghttp2", "libnghttp2"],
"nghttp3" => ["ngtcp2/nghttp3", "libnghttp3"],
"ngtcp2" => ["ngtcp2", "libngtcp2"],
"openssl" => ["openssl/openssl", "openssl@3"],
"simdjson" => ["simdjson", "simdjson"],
"sqlite" => ["sqlite", "sqlite"],
"uvwasi" => ["uvwasi", "uvwasi"],
"zlib" => ["zlib", ("zlib-ng-compat" unless OS.mac?)],
"zstd" => ["zstd", "zstd"],
}.each do |flag, (subdir, formula)|
rm_r(buildpath/"deps"/subdir)
args << "--shared-#{flag}"
if formula
args << "--shared-#{flag}-includes=#{Formula[formula].include}"
args << "--shared-#{flag}-libpath=#{Formula[formula].lib}"
end
end
# TODO: Try to devendor these libraries.
# - `--shared-gtest` is only used for building the test suite, which we don't run here.
# - `--shared-simdutf` seems to result in build failures.
# - `--shared-temporal_capi` is only used when building with `--v8-enable-temporal-support`
# - `--shared-lief` is not available as dependency in Homebrew.
ignored_shared_flags = %w[
gtest
simdutf
temporal_capi
lief
].map { |library| "--shared-#{library}" }
configure_help = Utils.safe_popen_read("./configure", "--help")
shared_flag_regex = /\[(--shared-[^ \]]+)\]/
configure_help.scan(shared_flag_regex) do |matches|
matches.each do |flag|
next if args.include?(flag) || ignored_shared_flags.include?(flag)
message = "Unused `--shared-*` flag: #{flag}"
if build.head?
opoo message
else
odie message
end
end
end
# Enabling LTO errors on Linux with:
# terminate called after throwing an instance of 'std::out_of_range'
# macOS also can't build with LTO when using LLVM Clang
# LTO is unpleasant if you have to build from source.
# FIXME: re-enable me, currently crashes sequoia runner after 6 hours
# args << "--enable-lto" if OS.mac? && DevelopmentTools.clang_build_version > 1699 && build.bottle?
system "./configure", *args
system "make", "install"
# Allow npm to find Node before installation has completed.
ENV.prepend_path "PATH", bin
bootstrap = buildpath/"npm_bootstrap"
bootstrap.install resource("npm")
# These dirs must exists before npm install.
mkdir_p libexec/"lib"
system "node", bootstrap/"bin/npm-cli.js", "install", "-ddd", "--global",
"--prefix=#{libexec}", resource("npm").cached_download
# The `package.json` stores integrity information about the above passed
# in `cached_download` npm resource, which breaks `npm -g outdated npm`.
# This copies back over the vanilla `package.json` to fix this issue.
cp bootstrap/"package.json", libexec/"lib/node_modules/npm"
# These symlinks are never used & they've caused issues in the past.
rm_r libexec/"share" if (libexec/"share").exist?
# Create temporary npm and npx symlinks until post_install is done.
ln_s libexec/"lib/node_modules/npm/bin/npm-cli.js", bin/"npm"
ln_s libexec/"lib/node_modules/npm/bin/npx-cli.js", bin/"npx"
# Use the _npm completion included in Zsh rather than generating broken completion
generate_completions_from_executable(bin/"npm", "completion", shells: [:bash], shell_parameter_format: :none)
end
def post_install
node_modules = HOMEBREW_PREFIX/"lib/node_modules"
node_modules.mkpath
# Remove npm but preserve all other modules across node updates/upgrades.
rm_r node_modules/"npm" if (node_modules/"npm").exist?
cp_r libexec/"lib/node_modules/npm", node_modules
# This symlink doesn't hop into homebrew_prefix/bin automatically so
# we make our own. This is a small consequence of our
# bottle-npm-and-retain-a-private-copy-in-libexec setup
# All other installs **do** symlink to homebrew_prefix/bin correctly.
# We ln rather than cp this because doing so mimics npm's normal install.
ln_sf node_modules/"npm/bin/npm-cli.js", bin/"npm"
ln_sf node_modules/"npm/bin/npx-cli.js", bin/"npx"
ln_sf bin/"npm", HOMEBREW_PREFIX/"bin/npm"
ln_sf bin/"npx", HOMEBREW_PREFIX/"bin/npx"
# Create manpage symlinks (or overwrite the old ones)
%w[man1 man5 man7].each do |man|
# Dirs must exist first: https://github.com/Homebrew/legacy-homebrew/issues/35969
mkdir_p HOMEBREW_PREFIX/"share/man/#{man}"
# still needed to migrate from copied file manpages to symlink manpages
rm(Dir[HOMEBREW_PREFIX/"share/man/#{man}/{npm.,npm-,npmrc.,package.json.,npx.}*"])
ln_sf Dir[node_modules/"npm/man/#{man}/{npm,package-,shrinkwrap-,npx}*"], HOMEBREW_PREFIX/"share/man/#{man}"
end
(node_modules/"npm/npmrc").atomic_write("prefix = #{HOMEBREW_PREFIX}\n")
end
test do
path = testpath/"test.js"
path.write "console.log('hello');"
output = shell_output("#{bin}/node #{path}").strip
assert_equal "hello", output
output = shell_output("#{bin}/node -e 'console.log(new Intl.NumberFormat(\"en-EN\").format(1234.56))'").strip
assert_equal "1,234.56", output
output = shell_output("#{bin}/node -e 'console.log(new Intl.NumberFormat(\"de-DE\").format(1234.56))'").strip
assert_equal "1.234,56", output
# make sure npm can find node
ENV.prepend_path "PATH", opt_bin
ENV.delete "NVM_NODEJS_ORG_MIRROR"
assert_equal which("node"), opt_bin/"node"
assert_path_exists HOMEBREW_PREFIX/"bin/npm", "npm must exist"
assert_predicate HOMEBREW_PREFIX/"bin/npm", :executable?, "npm must be executable"
npm_args = ["-ddd", "--cache=#{HOMEBREW_CACHE}/npm_cache", "--build-from-source"]
system HOMEBREW_PREFIX/"bin/npm", *npm_args, "install", "npm@latest"
system HOMEBREW_PREFIX/"bin/npm", *npm_args, "install", "nan"
assert_path_exists HOMEBREW_PREFIX/"bin/npx", "npx must exist"
assert_predicate HOMEBREW_PREFIX/"bin/npx", :executable?, "npx must be executable"
assert_match "< hello >", shell_output("#{HOMEBREW_PREFIX}/bin/npx --yes cowsay hello")
# Test `uvwasi` is linked correctly
(testpath/"wasi-smoke-test.mjs").write <<~JAVASCRIPT
import { WASI } from 'node:wasi';
// Minimal WASM that:
// - imports wasi proc_exit(i32)->()
// - exports memory (required by Node's WASI binding)
// - exports _start which calls proc_exit(42)
const wasmBytes = new Uint8Array([
// \0asm + version
0x00,0x61,0x73,0x6d, 0x01,0x00,0x00,0x00,
// Type section: 2 types: (i32)->() and ()->()
0x01,0x08, 0x02,
0x60,0x01,0x7f,0x00,
0x60,0x00,0x00,
// Import section: wasi_snapshot_preview1.proc_exit : func(type 0)
0x02,0x24, 0x01,
0x16, // module name len = 22
0x77,0x61,0x73,0x69,0x5f,0x73,0x6e,0x61,0x70,0x73,0x68,0x6f,0x74,0x5f,0x70,0x72,0x65,0x76,0x69,0x65,0x77,0x31,
0x09, // name len = 9
0x70,0x72,0x6f,0x63,0x5f,0x65,0x78,0x69,0x74,
0x00, // import kind = func
0x00, // type index 0
// Function section: 1 function (type index 1 = ()->())
0x03,0x02, 0x01, 0x01,
// Memory section: one memory with min=1 page; export later
0x05,0x03, 0x01, 0x00, 0x01,
// Export section: export "_start" (func 1) and "memory" (mem 0)
0x07,0x13, 0x02,
0x06, 0x5f,0x73,0x74,0x61,0x72,0x74, 0x00, 0x01,
0x06, 0x6d,0x65,0x6d,0x6f,0x72,0x79, 0x02, 0x00,
// Code section: body for func 1: i32.const 42; call 0; end
0x0a,0x08, 0x01,
0x06, 0x00, 0x41,0x2a, 0x10,0x00, 0x0b
]);
const wasi = new WASI({
version: 'preview1',
returnOnExit: true
});
const { instance } = await WebAssembly.instantiate(wasmBytes, wasi.getImportObject());
// This should return 42 if uvwasi is correctly linked & wired.
const rc = wasi.start(instance);
if (rc === 42) {
console.log('PASS: uvwasi proc_exit(42) worked (exitCode=42)');
process.exit(0);
} else {
console.error('FAIL: unexpected return', rc);
process.exit(2);
}
JAVASCRIPT
system bin/"node", "wasi-smoke-test.mjs"
end
end
+49
View File
@@ -0,0 +1,49 @@
# frozen_string_literal: true
# Generated by generate_tap.py for local/mirror
class Opencode < Formula
desc "AI coding agent, built for the terminal"
homepage "https://opencode.ai"
url "https://homebrew.mirror.ygg/sources/c041605e77383641405cd7d4f4bd42f7f3a1d98b8369eb2420da4e1041ed1fac--opencode--1.17.5.x86_64_linux.bottle.1.tar.gz"
sha256 "05165ae40c9b222db275c8482300c948e881a6767aed2e67056223f43069f99c"
license "MIT"
livecheck do
throttle 5
end
bottle do
root_url "https://homebrew.mirror.ygg/bottles"
rebuild 1
sha256 arm64_tahoe: "ca653eb8c0a682d6d18fccfdeff1294768df49a617a3d7c799948fe4d4f1467a"
sha256 arm64_sequoia: "ca653eb8c0a682d6d18fccfdeff1294768df49a617a3d7c799948fe4d4f1467a"
sha256 arm64_sonoma: "ca653eb8c0a682d6d18fccfdeff1294768df49a617a3d7c799948fe4d4f1467a"
sha256 cellar: :any_skip_relocation, sonoma: "18f5988198e1c8804fb1f14358b59c9ae87a39940613a4dc7d6021266882ca26"
sha256 cellar: :any_skip_relocation, arm64_linux: "984002edcfa2b6cd6e1a9aac60fa633c405ba7c84eb4db30177a69a6dabfd09b"
sha256 cellar: :any_skip_relocation, x86_64_linux: "7b94552644a7fa937b46efbdc86707969caa898a8131aa79561d8412ccc806da"
end
depends_on "node"
depends_on "ripgrep"
def install
system "npm", "install", *std_npm_args(ignore_scripts: false)
bin.install_symlink libexec.glob("bin/*")
# Remove binaries for other architectures, `-musl`, `-baseline`, and `-baseline-musl`
arch = Hardware::CPU.arm? ? "arm64" : "x64"
os = OS.linux? ? "linux" : "darwin"
(libexec/"lib/node_modules/opencode-ai/node_modules").children.each do |d|
next unless d.directory?
rm_r d if d.basename.to_s != "opencode-#{os}-#{arch}"
end
generate_completions_from_executable(bin/"opencode", "completion", shell_parameter_format: :none, shells: [:zsh])
end
test do
assert_match version.to_s, shell_output("#{bin}/opencode --version")
assert_match "opencode", shell_output("#{bin}/opencode models")
end
end
+120
View File
@@ -0,0 +1,120 @@
# frozen_string_literal: true
# Generated by generate_tap.py for local/mirror
class Pkgconf < Formula
desc "Package compiler and linker metadata toolkit"
homepage "https://github.com/pkgconf/pkgconf"
url "https://homebrew.mirror.ygg/sources/325cb439c33323ba98a33e8a620cdca8190b3256dfdd768e8bd0a98387970f82--pkgconf--2.5.1.x86_64_linux.bottle.tar.gz"
mirror "https://fossies.org/linux/misc/pkgconf-2.5.1.tar.xz"
mirror "http://fresh-center.net/linux/misc/pkgconf-2.5.1.tar.xz"
sha256 "cd05c9589b9f86ecf044c10a2269822bc9eb001eced2582cfffd658b0a50c243"
license "ISC"
compatibility_version 1
livecheck do
url "https://distfiles.ariadne.space/pkgconf/"
regex(/href=.*?pkgconf[._-]v?(\d+(?:\.\d+)+)\.t/i)
end
bottle do
root_url "https://homebrew.mirror.ygg/bottles"
sha256 arm64_tahoe: "84f26aae5e27d846e00a9fb741dfe3b02a14cb2f81ca4a4246617379cda99fc0"
sha256 arm64_sequoia: "6fabdc3d0a656e2d505aec4e39b2f8e354601ee141469554fa71eabc3386e18f"
sha256 arm64_sonoma: "bc7f9963756598248220da128a5f06ea0e6685aa7cd965a5ce357fcfaad2cdec"
sha256 arm64_ventura: "8d53ac0deb003f8866315c4c27a1aa4767467c9fa13c912f52cb29e37fbe7916"
sha256 tahoe: "ab1a7c8edaffa3a27400174deb4845140bdd56942d9ab2a7bccdf30f7ef74d91"
sha256 sequoia: "a074f871aa476dec1101c13b4fcfbb9354a8b35bcb6e056f8411463913632071"
sha256 sonoma: "439e8e638986c4423f430719f28cd7c62e8d9a1b87ac658c069fd5da939784f8"
sha256 ventura: "e38acbfd930c9588f4d1eabe061b956948aaff32cccb30c457430779c1e4f7f5"
sha256 arm64_linux: "abdf9fbefab1d7b7219a619fb5bd44b58c00a71146a43cb24b71700c2ead369e"
sha256 x86_64_linux: "9df0ce4d9ebae822b763a9c18565d1596a40b2a2e5849c743e768a99f554f24b"
end
head do
url "https://github.com/pkgconf/pkgconf.git", branch: "master"
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "libtool" => :build
end
def install
if build.head?
ENV["LIBTOOLIZE"] = "glibtoolize"
system "./autogen.sh"
end
pc_path = %W[
#{HOMEBREW_PREFIX}/lib/pkgconfig
#{HOMEBREW_PREFIX}/share/pkgconfig
]
pc_path += if OS.mac?
%W[
/usr/local/lib/pkgconfig
/usr/lib/pkgconfig
#{HOMEBREW_LIBRARY}/Homebrew/os/mac/pkgconfig/#{MacOS.version}
]
else
["#{HOMEBREW_LIBRARY}/Homebrew/os/linux/pkgconfig"]
end
args = %W[
--disable-silent-rules
--with-pkg-config-dir=#{pc_path.uniq.join(File::PATH_SEPARATOR)}
--with-system-includedir=#{MacOS.sdk_path if OS.mac?}/usr/include
--with-system-libdir=/usr/lib
]
system "./configure", *args, *std_configure_args
system "make"
system "make", "install"
# Make `pkgconf` a drop-in replacement for `pkg-config` by adding symlink[^1].
# Similar to Debian[^2], Fedora, ArchLinux and MacPorts.
#
# [^1]: https://github.com/pkgconf/pkgconf/#pkg-config-symlink
# [^2]: https://salsa.debian.org/debian/pkgconf/-/blob/debian/unstable/debian/pkgconf.links?ref_type=heads
bin.install_symlink "pkgconf" => "pkg-config"
man1.install_symlink "pkgconf.1" => "pkg-config.1"
end
test do
(testpath/"foo.pc").write <<~PC
prefix=/usr
exec_prefix=${prefix}
includedir=${prefix}/include
libdir=${exec_prefix}/lib
Name: foo
Description: The foo library
Version: 1.0.0
Cflags: -I${includedir}/foo
Libs: -L${libdir} -lfoo
PC
ENV["PKG_CONFIG_LIBDIR"] = testpath
system bin/"pkgconf", "--validate", "foo"
assert_equal "1.0.0", shell_output("#{bin}/pkgconf --modversion foo").strip
assert_equal "-lfoo", shell_output("#{bin}/pkgconf --libs-only-l foo").strip
assert_equal "-I/usr/include/foo", shell_output("#{bin}/pkgconf --cflags foo").strip
(testpath/"test.c").write <<~C
#include <assert.h>
#include <libpkgconf/libpkgconf.h>
int main(void) {
assert(pkgconf_compare_version(LIBPKGCONF_VERSION_STR, LIBPKGCONF_VERSION_STR) == 0);
return 0;
}
C
system ENV.cc, "test.c", "-I#{include}/pkgconf", "-L#{lib}", "-lpkgconf"
system "./a.out"
# Make sure system-libdir is removed as it can cause problems in superenv
if OS.mac?
ENV.delete "PKG_CONFIG_LIBDIR"
refute_match "-L/usr/lib", shell_output("#{bin}/pkgconf --libs libcurl")
end
end
end
+537
View File
@@ -0,0 +1,537 @@
# frozen_string_literal: true
# Generated by generate_tap.py for local/mirror
class PythonAT312 < Formula
desc "Interpreted, interactive, object-oriented programming language"
homepage "https://www.python.org/"
url "https://homebrew.mirror.ygg/sources/2f434a9769faa918245f9fe345fdd92c98e3801d6e4c47ee4ee78ced5ab3cf87--python@3.12--3.12.13_4.x86_64_linux.bottle.tar.gz"
sha256 "0816c4761c97ecdb3f50a3924de0a93fd78cb63ee8e6c04201ddfaedca500b0b"
license "Python-2.0"
revision 4
compatibility_version 1
livecheck do
url "https://www.python.org/downloads/source/"
regex(%r{href=.*?/Python[._-]v?(3\.12(?:\.\d+)*)\.t}i)
end
bottle do
root_url "https://homebrew.mirror.ygg/bottles"
sha256 arm64_tahoe: "c72a33bdd21a08ee0531b6acfe8bda91527410112ae1cef1e177aea5bdd74fde"
sha256 arm64_sequoia: "99438a041a9c1cb8762fbcd4afa03d04cacc3650fa1e2fe4631cca5d054f7000"
sha256 arm64_sonoma: "ef30f3d6f5bb1bf50202545ed16e8bd5190db60409c932f8a42f9e85d78a89b9"
sha256 tahoe: "bc2cecf221ab3fb3e73ed98cbf89e3156ad781ab751d9349a622a66ae868181b"
sha256 sequoia: "bc41deb6f92940f2c74bc3fdd42397f9aa4e612fb59a7b40f6973d9cf5c6ff39"
sha256 sonoma: "0e0141c5f78f41e5a7471a81fd6be63af781fe7abfe19dd4ddb2173d73e8a3fa"
sha256 arm64_linux: "bc942a1d5c7b91b8d596aefc3dd4bcca4c76afa4b465e5903de56f41f68cd43d"
sha256 x86_64_linux: "e754f146350ac35585336b7b415257e317fbb472614e758577f9115738736575"
end
depends_on "pkgconf" => :build
depends_on "mpdecimal"
depends_on "openssl@3"
depends_on "sqlite"
depends_on "xz"
uses_from_macos "bzip2"
uses_from_macos "expat", since: :sequoia
uses_from_macos "libedit"
uses_from_macos "libffi"
uses_from_macos "libxcrypt"
uses_from_macos "ncurses"
uses_from_macos "unzip"
on_linux do
depends_on "libnsl"
depends_on "libtirpc"
depends_on "zlib-ng-compat"
end
link_overwrite "lib/python3.12/site-packages/pip*"
link_overwrite "lib/python3.12/site-packages/wheel*"
pypi_packages package_name: "",
extra_packages: %w[flit-core pip wheel]
resource "flit-core" do
url "https://files.pythonhosted.org/packages/69/59/b6fc2188dfc7ea4f936cd12b49d707f66a1cb7a1d2c16172963534db741b/flit_core-3.12.0.tar.gz"
sha256 "18f63100d6f94385c6ed57a72073443e1a71a4acb4339491615d0f16d6ff01b2"
end
resource "packaging" do
url "https://files.pythonhosted.org/packages/d7/f1/e7a6dd94a8d4a5626c03e4e99c87f241ba9e350cd9e6d75123f992427270/packaging-26.2.tar.gz"
sha256 "ff452ff5a3e828ce110190feff1178bb1f2ea2281fa2075aadb987c2fb221661"
end
resource "pip" do
url "https://files.pythonhosted.org/packages/01/91/47e7d486260f618783899587af63ccf7980fb60245c3e63dd4571c6b57ad/pip-26.1.2.tar.gz"
sha256 "f49cd134c61cf2fd75e0ce2676db03e4054504a5a4986d00f8299ae632dc4605"
end
resource "wheel" do
url "https://files.pythonhosted.org/packages/39/62/75f18a0f03b4219c456652c7780e4d749b929eb605c098ce3a5b6b6bc081/wheel-0.47.0.tar.gz"
sha256 "cc72bd1009ba0cf63922e28f94d9d83b920aa2bb28f798a31d0691b02fa3c9b3"
end
# Modify default sysconfig to match the brew install layout.
# Remove when a non-patching mechanism is added (https://bugs.python.org/issue43976).
# We (ab)use osx_framework_library to exploit pip behaviour to allow --prefix to still work.
patch do
url "https://raw.githubusercontent.com/Homebrew/homebrew-core/1cf441a0/Patches/python/3.11-sysconfig.diff"
sha256 "8bfe417c815da4ca2c0a2457ce7ef81bc9dae310e20e4fb36235901ea4be1658"
end
def lib_cellar
on_macos do
return frameworks/"Python.framework/Versions"/version.major_minor/"lib/python#{version.major_minor}"
end
on_linux do
return lib/"python#{version.major_minor}"
end
end
def site_packages_cellar = lib_cellar/"site-packages"
# The HOMEBREW_PREFIX location of site-packages.
def site_packages = HOMEBREW_PREFIX/"lib/python#{version.major_minor}/site-packages"
def altinstall? = name != Formula["python3"].name
def python3 = bin/"python#{version.major_minor}"
def install
# Unset these so that installing pip and setuptools puts them where we want
# and not into some other Python the user has installed.
ENV["PYTHONHOME"] = nil
ENV["PYTHONPATH"] = nil
# Override the auto-detection of libmpdec, which assumes a universal build.
# This is currently an inreplace due to https://github.com/python/cpython/issues/98557.
if OS.mac?
inreplace "configure", "libmpdec_machine=universal",
"libmpdec_machine=#{ENV["PYTHON_DECIMAL_WITH_MACHINE"] = Hardware::CPU.arm? ? "uint128" : "x64"}"
end
# The --enable-optimization and --with-lto flags diverge from what upstream
# python does for their macOS binary releases. They have chosen not to apply
# these flags because they want one build that will work across many macOS
# releases. Homebrew is not so constrained because the bottling
# infrastructure specializes for each macOS major release.
args = %W[
--prefix=#{prefix}
--enable-ipv6
--datarootdir=#{share}
--datadir=#{share}
--without-ensurepip
--enable-loadable-sqlite-extensions
--with-openssl=#{Formula["openssl@3"].opt_prefix}
--enable-optimizations
--with-system-expat
--with-system-libmpdec
--with-readline=editline
]
# Python re-uses flags when building native modules.
# Since we don't want native modules prioritizing the brew
# include path, we move them to [C|LD]FLAGS_NODIST.
# Note: Changing CPPFLAGS causes issues with dbm, so we
# leave it as-is.
cflags = []
cflags_nodist = ["-I#{HOMEBREW_PREFIX}/include"]
ldflags = []
ldflags_nodist = ["-L#{HOMEBREW_PREFIX}/lib", "-Wl,-rpath,#{HOMEBREW_PREFIX}/lib"]
cppflags = ["-I#{HOMEBREW_PREFIX}/include"]
if OS.mac?
# Enabling LTO on Linux makes libpython3.*.a unusable for anyone whose GCC
# install does not match the one in CI _exactly_ (major and minor version).
# https://github.com/orgs/Homebrew/discussions/3734
args << "--with-lto"
args << "--enable-framework=#{frameworks}"
args << "--with-dtrace"
args << "--with-dbmliborder=ndbm"
# Avoid linking to libgcc https://mail.python.org/pipermail/python-dev/2012-February/116205.html
args << "MACOSX_DEPLOYMENT_TARGET=#{MacOS.version}"
else
args << "--enable-shared"
args << "--with-dbmliborder="
end
if OS.linux?
# Python's configure adds the system ncurses include entry to CPPFLAGS
# when doing curses header check. The check may fail when there exists
# a 32-bit system ncurses (conflicts with the brewed 64-bit one).
# See https://github.com/Homebrew/linuxbrew-core/pull/22307#issuecomment-781896552
# We want our ncurses! Override system ncurses includes!
inreplace "configure", 'CPPFLAGS="$CPPFLAGS -I/usr/include/ncursesw"',
"CPPFLAGS=\"$CPPFLAGS -I#{Formula["ncurses"].opt_include}\""
end
# Allow python modules to use ctypes.find_library to find homebrew's stuff
# even if homebrew is not a /usr/local/lib. Try this with:
# `brew install enchant && pip install pyenchant`
inreplace "./Lib/ctypes/macholib/dyld.py" do |f|
f.gsub! "DEFAULT_LIBRARY_FALLBACK = [",
"DEFAULT_LIBRARY_FALLBACK = [ '#{HOMEBREW_PREFIX}/lib', '#{Formula["openssl@3"].opt_lib}',"
f.gsub! "DEFAULT_FRAMEWORK_FALLBACK = [", "DEFAULT_FRAMEWORK_FALLBACK = [ '#{HOMEBREW_PREFIX}/Frameworks',"
end
args << "CFLAGS=#{cflags.join(" ")}" unless cflags.empty?
args << "CFLAGS_NODIST=#{cflags_nodist.join(" ")}" unless cflags_nodist.empty?
args << "LDFLAGS=#{ldflags.join(" ")}" unless ldflags.empty?
args << "LDFLAGS_NODIST=#{ldflags_nodist.join(" ")}" unless ldflags_nodist.empty?
args << "CPPFLAGS=#{cppflags.join(" ")}" unless cppflags.empty?
# Disabled modules - provided in separate formulae
args += %w[
py_cv_module__tkinter=n/a
]
system "./configure", *args
system "make"
ENV.deparallelize do
# The `altinstall` target prevents the installation of files with only Python's major
# version in its name. This allows us to link multiple versioned Python formulae.
# https://github.com/python/cpython#installing-multiple-versions
#
# Tell Python not to install into /Applications (default for framework builds)
target = "#{"alt" if altinstall?}install"
system "make", target, "PYTHONAPPSDIR=#{prefix}"
system "make", "frameworkinstallextras", "PYTHONAPPSDIR=#{pkgshare}" if OS.mac?
end
if OS.mac?
# Any .app get a " 3" attached, so it does not conflict with python 2.x.
prefix.glob("*.app") { |app| mv app, app.to_s.sub(/\.app$/, " 3.app") }
pc_dir = frameworks/"Python.framework/Versions"/version.major_minor/"lib/pkgconfig"
# Symlink the pkgconfig files into HOMEBREW_PREFIX so they're accessible.
(lib/"pkgconfig").install_symlink pc_dir.children
# Prevent third-party packages from building against fragile Cellar paths
bad_cellar_path_files = [
lib_cellar/"_sysconfigdata__darwin_darwin.py",
lib_cellar/"config-#{version.major_minor}-darwin/Makefile",
pc_dir/"python-#{version.major_minor}.pc",
pc_dir/"python-#{version.major_minor}-embed.pc",
]
inreplace bad_cellar_path_files, prefix, opt_prefix
# Help third-party packages find the Python framework
inreplace lib_cellar/"config-#{version.major_minor}-darwin/Makefile",
/^LINKFORSHARED=(.*)PYTHONFRAMEWORKDIR(.*)/,
"LINKFORSHARED=\\1PYTHONFRAMEWORKINSTALLDIR\\2"
# Symlink the pkgconfig files into HOMEBREW_PREFIX so they're accessible.
(lib/"pkgconfig").install_symlink pc_dir.children
# Fix for https://github.com/Homebrew/homebrew-core/issues/21212
inreplace lib_cellar/"_sysconfigdata__darwin_darwin.py",
%r{('LINKFORSHARED': .*?)'(Python.framework/Versions/3.\d+/Python)'}m,
"\\1'#{opt_prefix}/Frameworks/\\2'"
# For an altinstall, remove symlinks that conflict with the main Python formula.
rm frameworks.glob("Python.framework/{Headers,Python,Resources,Versions/Current}") if altinstall?
else
# Prevent third-party packages from building against fragile Cellar paths
inreplace Dir[lib_cellar/"**/_sysconfigdata_*linux_x86_64-*.py",
lib_cellar/"config*/Makefile",
bin/"python#{version.major_minor}-config",
lib/"pkgconfig/python-3*.pc"],
prefix, opt_prefix
inreplace bin/"python#{version.major_minor}-config",
'prefix_real=$(installed_prefix "$0")',
"prefix_real=#{opt_prefix}"
# For an altinstall, remove symlinks that conflict with the main Python formula.
rm lib/"libpython3.so" if altinstall?
end
# Remove the site-packages that Python created in its Cellar.
rm_r site_packages_cellar.children
# Prepare a wheel of wheel to install later.
common_pip_args = %w[
-v
--no-deps
--no-binary :all:
--no-index
--no-build-isolation
]
whl_build = buildpath/"whl_build"
system python3, "-m", "venv", whl_build
%w[flit-core wheel].each do |r|
resource(r).stage do
system whl_build/"bin/pip3", "install", *common_pip_args, "."
end
end
resource("wheel").stage do
system whl_build/"bin/pip3", "wheel", *common_pip_args,
"--wheel-dir=#{libexec}",
"."
end
# Replace bundled pip with our own.
rm lib_cellar.glob("ensurepip/_bundled/pip-*.whl")
resource("pip").stage do
system whl_build/"bin/pip3", "wheel", *common_pip_args,
"--wheel-dir=#{lib_cellar}/ensurepip/_bundled",
"."
end
# Patch ensurepip to bootstrap our updated version of pip
inreplace lib_cellar/"ensurepip/__init__.py" do |s|
s.gsub!(/_PIP_VERSION = .*/, "_PIP_VERSION = \"#{resource("pip").version}\"")
end
# Ensure that our new pip wheel is globally readable.
chmod "ugo+r", lib_cellar.glob("ensurepip/_bundled/pip-*.whl")
# Install unversioned (and for an altinstall, major-versioned) symlinks in libexec/bin.
{
"idle" => "idle#{version.major_minor}",
"pydoc" => "pydoc#{version.major_minor}",
"python" => "python#{version.major_minor}",
"python-config" => "python#{version.major_minor}-config",
}.merge(altinstall? ? {
"idle3" => "idle#{version.major_minor}",
"pydoc3" => "pydoc#{version.major_minor}",
"python3" => "python#{version.major_minor}",
"python3-config" => "python#{version.major_minor}-config",
} : {}).each do |short_name, long_name|
(libexec/"bin").install_symlink (bin/long_name).realpath => short_name
end
# Bootstrap initial install of pip.
system python3, "-Im", "ensurepip"
# Install desired versions of pip, wheel using the version of
# pip bootstrapped by ensurepip.
# Note that while we replaced the ensurepip wheels, there's no guarantee
# ensurepip actually used them, since other existing installations could
# have been picked up (and we can't pass --ignore-installed).
root_site_packages = lib/"python#{version.major_minor}/site-packages"
bundled = lib_cellar/"ensurepip/_bundled"
system python3, "-Im", "pip", "install", "-v",
"--no-deps",
"--no-index",
"--upgrade",
"--isolated",
"--target=#{root_site_packages}",
bundled/"pip-#{resource("pip").version}-py3-none-any.whl",
libexec/"wheel-#{resource("wheel").version}-py3-none-any.whl"
# pip install with --target flag will just place the bin folder into the
# target, so move its contents into the appropriate location
mv (root_site_packages/"bin").children, bin
rmdir root_site_packages/"bin"
rm bin/"pip"
rm bin/"pip3" if altinstall?
mv bin/"wheel", bin/"wheel#{version.major_minor}"
bin.install_symlink "wheel#{version.major_minor}" => "wheel3" unless altinstall?
# Install unversioned (and for an altinstall, major-versioned) symlinks in libexec/bin.
{
"pip" => "pip#{version.major_minor}",
"wheel" => "wheel#{version.major_minor}",
}.merge(altinstall? ? {
"pip3" => "pip#{version.major_minor}",
"wheel3" => "wheel#{version.major_minor}",
} : {}).each do |short_name, long_name|
(libexec/"bin").install_symlink (bin/long_name).realpath => short_name
end
if OS.mac?
# Replace framework site-packages with a symlink to the real one.
rm_r site_packages_cellar
site_packages_cellar.parent.install_symlink root_site_packages
end
# Write out sitecustomize.py
(lib_cellar/"sitecustomize.py").atomic_write(sitecustomize)
# Mark Homebrew python as externally managed: https://peps.python.org/pep-0668/#marking-an-interpreter-as-using-an-external-package-manager
# Placed after ensurepip since it invokes pip in isolated mode, meaning
# we can't pass --break-system-packages.
(lib_cellar/"EXTERNALLY-MANAGED").write <<~INI
[externally-managed]
Error=To install Python packages system-wide, try brew install
xyz, where xyz is the package you are trying to
install.
If you wish to install a Python library that isn't in Homebrew,
use a virtual environment:
python3 -m venv path/to/venv
source path/to/venv/bin/activate
python3 -m pip install xyz
If you wish to install a Python application that isn't in Homebrew,
it may be easiest to use 'pipx install xyz', which will manage a
virtual environment for you. You can install pipx with
brew install pipx
You may restore the old behavior of pip by passing
the '--break-system-packages' flag to pip, or by adding
'break-system-packages = true' to your pip.conf file. The latter
will permanently disable this error.
If you disable this error, we STRONGLY recommend that you additionally
pass the '--user' flag to pip, or set 'user = true' in your pip.conf
file. Failure to do this can result in a broken Homebrew installation.
Read more about this behavior here: <https://peps.python.org/pep-0668/>
INI
end
def sitecustomize
<<~PYTHON
# This file is created by Homebrew and is executed on each python startup.
# Don't print from here, or else python command line scripts may fail!
# <https://docs.brew.sh/Homebrew-and-Python>
import re
import os
import site
import sys
if sys.version_info[:2] != (#{version.major}, #{version.minor}):
# This can only happen if the user has set the PYTHONPATH to a mismatching site-packages directory.
# Every Python looks at the PYTHONPATH variable and we can't fix it here in sitecustomize.py,
# because the PYTHONPATH is evaluated after the sitecustomize.py. Many modules (e.g. PyQt4) are
# built only for a specific version of Python and will fail with cryptic error messages.
# In the end this means: Don't set the PYTHONPATH permanently if you use different Python versions.
exit(f'Your PYTHONPATH points to a site-packages dir for Python #{version.major_minor} '
f'but you are running Python {sys.version_info[0]}.{sys.version_info[1]}!\\n'
f' PYTHONPATH is currently: "{os.environ["PYTHONPATH"]}"\\n'
f' You should `unset PYTHONPATH` to fix this.')
# Only do this for a brewed python:
if os.path.realpath(sys.executable).startswith('#{rack}'):
# Shuffle /Library site-packages to the end of sys.path
library_site = '/Library/Python/#{version.major_minor}/site-packages'
library_packages = [p for p in sys.path if p.startswith(library_site)]
sys.path = [p for p in sys.path if not p.startswith(library_site)]
# .pth files have already been processed so don't use addsitedir
sys.path.extend(library_packages)
# the Cellar site-packages is a symlink to the HOMEBREW_PREFIX
# site_packages; prefer the shorter paths
long_prefix = re.compile(r'#{rack}/[0-9\\._abrc]+/(?:Frameworks/Python\\.framework/Versions/#{version.major_minor}/)?lib/python#{version.major_minor}/site-packages')
sys.path = [long_prefix.sub('#{site_packages}', p) for p in sys.path]
# Set the sys.executable to use the opt_prefix. Only do this if PYTHONEXECUTABLE is not
# explicitly set and we are not in a virtualenv:
if 'PYTHONEXECUTABLE' not in os.environ and sys.prefix == sys.base_prefix:
sys.executable = sys._base_executable = '#{opt_bin}/python#{version.major_minor}'
if 'PYTHONHOME' not in os.environ:
cellar_prefix = re.compile(r'#{rack}/[0-9\\._abrc]+(?=/|$)')
if os.path.realpath(sys.base_prefix).startswith('#{rack}'):
new_prefix = cellar_prefix.sub('#{opt_prefix}', sys.base_prefix)
site.PREFIXES[:] = [new_prefix if x == sys.base_prefix else x for x in site.PREFIXES]
if sys.prefix == sys.base_prefix:
sys.prefix = new_prefix
sys.base_prefix = new_prefix
if os.path.realpath(sys.base_exec_prefix).startswith('#{rack}'):
new_exec_prefix = cellar_prefix.sub('#{opt_prefix}', sys.base_exec_prefix)
site.PREFIXES[:] = [new_exec_prefix if x == sys.base_exec_prefix else x for x in site.PREFIXES]
if sys.exec_prefix == sys.base_exec_prefix:
sys.exec_prefix = new_exec_prefix
sys.base_exec_prefix = new_exec_prefix
# Make site.getsitepackages() return the HOMEBREW_PREFIX site-packages,
# but only if we are outside a venv or in one with include-system-site-packages.
if sys.base_prefix in site.PREFIXES:
site.PREFIXES.insert(site.PREFIXES.index(sys.base_prefix), '#{HOMEBREW_PREFIX}')
site.addsitedir('#{site_packages}')
# Check for and add the prefix of split Python formulae.
for split_module in ["tk", "gdbm"]:
split_prefix = f"#{HOMEBREW_PREFIX}/opt/python-{split_module}@#{version.major_minor}/libexec"
if os.path.isdir(split_prefix):
sys.path.append(split_prefix)
PYTHON
end
def caveats
dbm_is = "`dbm.gnu` is"
on_linux do
dbm_is = "`dbm.gnu` and `dbm.ndbm` are"
end
<<~EOS
Python is installed as
#{HOMEBREW_PREFIX}/bin/python#{version.major_minor}
Unversioned and major-versioned symlinks `python`, `python3`, `python-config`, `python3-config`, `pip`, `pip3`, etc. pointing to
`python#{version.major_minor}`, `python#{version.major_minor}-config`, `pip#{version.major_minor}` etc., respectively, are installed into
#{opt_libexec}/bin
If you do not need a specific version of Python, and always want Homebrew's `python3` in your PATH:
brew install python3
`idle#{version.major_minor}` requires tkinter, which is available separately:
brew install python-tk@#{version.major_minor}
#{dbm_is} available separately:
brew install python-gdbm@#{version.major_minor}
For more information about Homebrew and Python, see: https://docs.brew.sh/Homebrew-and-Python
EOS
end
test do
# Check if sqlite is ok, because we build with --enable-loadable-sqlite-extensions
# and it can occur that building sqlite silently fails if OSX's sqlite is used.
system python3, "-c", "import sqlite3"
# check to see if we can create a venv
system python3, "-m", "venv", testpath/"myvenv"
# Check if some other modules import. Then the linked libs are working.
system python3, "-c", "import _ctypes"
system python3, "-c", "import _decimal"
system python3, "-c", "import pyexpat"
system python3, "-c", "import readline"
system python3, "-c", "import zlib"
# tkinter is provided in a separate formula
assert_match "ModuleNotFoundError: No module named '_tkinter'",
shell_output("#{python3} -Sc 'import tkinter' 2>&1", 1)
# gdbm is provided in a separate formula
assert_match "ModuleNotFoundError: No module named '_gdbm'",
shell_output("#{python3} -Sc 'import _gdbm' 2>&1", 1)
assert_match "ModuleNotFoundError: No module named '_gdbm'",
shell_output("#{python3} -Sc 'import dbm.gnu' 2>&1", 1)
# Verify that the selected DBM interface works on macOS.
# Linux requires installing python-gdbm formula
(testpath/"dbm_test.py").write <<~PYTHON
import dbm
with dbm.ndbm.open("test", "c") as db:
db[b"foo \\xbd"] = b"bar \\xbd"
with dbm.ndbm.open("test", "r") as db:
assert list(db.keys()) == [b"foo \\xbd"]
assert b"foo \\xbd" in db
assert db[b"foo \\xbd"] == b"bar \\xbd"
PYTHON
system python3, "dbm_test.py" if OS.mac?
system bin/"pip#{version.major_minor}", "list", "--format=columns"
# Check our sitecustomize.py
assert_match HOMEBREW_CELLAR.to_s, shell_output("#{python3} -Sc 'import sys; print(sys.base_prefix)'")
refute_match HOMEBREW_CELLAR.to_s, shell_output("#{python3} -c 'import sys; print(sys.base_prefix)'")
refute_match site_packages_cellar.to_s, shell_output("#{python3} -c 'import sys; print(sys.path)'")
# Verify our sysconfig patches
sysconfig_path = "import sysconfig; print(sysconfig.get_paths(\"osx_framework_library\")[\"data\"])"
assert_equal HOMEBREW_PREFIX.to_s, shell_output("#{python3} -c '#{sysconfig_path}'").strip
linkforshared_var = "import sysconfig; print(sysconfig.get_config_var(\"LINKFORSHARED\"))"
assert_match opt_prefix.to_s, shell_output("#{python3} -c '#{linkforshared_var}'") if OS.mac?
# Check our externally managed marker
assert_match "If you wish to install a Python library",
shell_output("#{python3} -m pip install pip 2>&1", 1)
end
end
+525
View File
@@ -0,0 +1,525 @@
# frozen_string_literal: true
# Generated by generate_tap.py for local/mirror
class PythonAT313 < Formula
desc "Interpreted, interactive, object-oriented programming language"
homepage "https://www.python.org/"
url "https://homebrew.mirror.ygg/sources/c5c8e77d9c288bb56de9c8f1a2fb9780e827f6628be6a62085262f45b40b7ae7--python@3.13--3.13.13_1.x86_64_linux.bottle.1.tar.gz"
sha256 "f9cde7b0e2ec8165d7326e2a0f59ea2686ce9d0c617dbbb3d66a7e54d31b74b9"
license "Python-2.0"
revision 1
compatibility_version 1
livecheck do
url "https://www.python.org/downloads/source/"
regex(%r{href=.*?/Python[._-]v?(3\.13(?:\.\d+)*)\.t}i)
end
bottle do
root_url "https://homebrew.mirror.ygg/bottles"
rebuild 1
sha256 arm64_tahoe: "b9fcf3efe9f2b77cf649bba40c72dc1d216cafc94e7762bc45d99e07041021f6"
sha256 arm64_sequoia: "46c2c36ab19c56b360a6f3e05e19fbc5410552bc728a588c045d2a6107a53846"
sha256 arm64_sonoma: "7fc4d080d28686d8d3b54bab9c2a1958d35abdf7d6bdb31ec58974ff55cf77df"
sha256 tahoe: "d938748bf044ce7a50f622fbdfb039bddaeba3d13b6c5eb7536bc4973e806fe0"
sha256 sequoia: "690991fc93c9d8a583be51bc1b8fe7d794fa1e5f8ae3ae8c614acef59a4af9b3"
sha256 sonoma: "356e8604188a1446e4d281975d2c071f7645c4a0794476c50c70b8928567d6f0"
sha256 arm64_linux: "26d1c264e1a631fe80c4349a349b40a6fd0b7fef0d030d014452e9f19ce15c45"
sha256 x86_64_linux: "3066469631b118d7a05ff51e5c9d6e3d9839c0daf1b83c1dab0972a3822f4d89"
end
depends_on "pkgconf" => :build
depends_on "mpdecimal"
depends_on "openssl@3"
depends_on "sqlite"
depends_on "xz"
uses_from_macos "bzip2"
uses_from_macos "expat", since: :sequoia
uses_from_macos "libedit"
uses_from_macos "libffi"
uses_from_macos "ncurses"
uses_from_macos "unzip"
on_linux do
depends_on "zlib-ng-compat"
end
link_overwrite "lib/python3.13/site-packages/pip*"
link_overwrite "lib/python3.13/site-packages/wheel*"
pypi_packages package_name: "",
extra_packages: %w[flit-core pip wheel]
resource "flit-core" do
url "https://files.pythonhosted.org/packages/69/59/b6fc2188dfc7ea4f936cd12b49d707f66a1cb7a1d2c16172963534db741b/flit_core-3.12.0.tar.gz"
sha256 "18f63100d6f94385c6ed57a72073443e1a71a4acb4339491615d0f16d6ff01b2"
end
resource "packaging" do
url "https://files.pythonhosted.org/packages/d7/f1/e7a6dd94a8d4a5626c03e4e99c87f241ba9e350cd9e6d75123f992427270/packaging-26.2.tar.gz"
sha256 "ff452ff5a3e828ce110190feff1178bb1f2ea2281fa2075aadb987c2fb221661"
end
resource "pip" do
url "https://files.pythonhosted.org/packages/73/7e/d2b04004e1068ad4fdfa2f227b839b5d03e602e47cdbbf49de71137c9546/pip-26.1.tar.gz"
sha256 "81e13ebcca3ffa8cc85e4deff5c27e1ee26dea0aa7fc2f294a073ac208806ff3"
end
resource "wheel" do
url "https://files.pythonhosted.org/packages/39/62/75f18a0f03b4219c456652c7780e4d749b929eb605c098ce3a5b6b6bc081/wheel-0.47.0.tar.gz"
sha256 "cc72bd1009ba0cf63922e28f94d9d83b920aa2bb28f798a31d0691b02fa3c9b3"
end
# Modify default sysconfig to match the brew install layout.
# Remove when a non-patching mechanism is added (https://bugs.python.org/issue43976).
# We (ab)use osx_framework_library to exploit pip behaviour to allow --prefix to still work.
patch do
url "https://raw.githubusercontent.com/Homebrew/homebrew-core/1cf441a0/Patches/python/3.13-sysconfig.diff"
sha256 "9f2eae1d08720b06ac3d9ef1999c09388b9db39dfb52687fc261ff820bff20c3"
end
def lib_cellar
on_macos do
return frameworks/"Python.framework/Versions"/version.major_minor/"lib/python#{version.major_minor}"
end
on_linux do
return lib/"python#{version.major_minor}"
end
end
def site_packages_cellar = lib_cellar/"site-packages"
# The HOMEBREW_PREFIX location of site-packages.
def site_packages = HOMEBREW_PREFIX/"lib/python#{version.major_minor}/site-packages"
def altinstall? = name != Formula["python3"].name
def python3 = bin/"python#{version.major_minor}"
def install
# Unset these so that installing pip and setuptools puts them where we want
# and not into some other Python the user has installed.
ENV["PYTHONHOME"] = nil
ENV["PYTHONPATH"] = nil
# Override the auto-detection of libmpdec, which assumes a universal build.
# This is currently an inreplace due to https://github.com/python/cpython/issues/98557.
if OS.mac?
inreplace "configure", "libmpdec_machine=universal",
"libmpdec_machine=#{ENV["PYTHON_DECIMAL_WITH_MACHINE"] = Hardware::CPU.arm? ? "uint128" : "x64"}"
end
# The --enable-optimization and --with-lto flags diverge from what upstream
# python does for their macOS binary releases. They have chosen not to apply
# these flags because they want one build that will work across many macOS
# releases. Homebrew is not so constrained because the bottling
# infrastructure specializes for each macOS major release.
args = %W[
--prefix=#{prefix}
--enable-ipv6
--datarootdir=#{share}
--datadir=#{share}
--without-ensurepip
--enable-loadable-sqlite-extensions
--with-openssl=#{Formula["openssl@3"].opt_prefix}
--enable-optimizations
--with-system-expat
--with-system-libmpdec
--with-readline=editline
]
# Python re-uses flags when building native modules.
# Since we don't want native modules prioritizing the brew
# include path, we move them to [C|LD]FLAGS_NODIST.
# Note: Changing CPPFLAGS causes issues with dbm, so we
# leave it as-is.
cflags = []
cflags_nodist = ["-I#{HOMEBREW_PREFIX}/include"]
ldflags = []
ldflags_nodist = ["-L#{HOMEBREW_PREFIX}/lib", "-Wl,-rpath,#{HOMEBREW_PREFIX}/lib"]
cppflags = ["-I#{HOMEBREW_PREFIX}/include"]
if OS.mac?
# Enabling LTO on Linux makes libpython3.*.a unusable for anyone whose GCC
# install does not match the one in CI _exactly_ (major and minor version).
# https://github.com/orgs/Homebrew/discussions/3734
args << "--with-lto"
args << "--enable-framework=#{frameworks}"
args << "--with-dtrace"
args << "--with-dbmliborder=ndbm"
# Avoid linking to libgcc https://mail.python.org/pipermail/python-dev/2012-February/116205.html
args << "MACOSX_DEPLOYMENT_TARGET=#{MacOS.version}"
else
args << "--enable-shared"
args << "--with-dbmliborder="
end
# Allow python modules to use ctypes.find_library to find homebrew's stuff
# even if homebrew is not a /usr/local/lib. Try this with:
# `brew install enchant && pip install pyenchant`
inreplace "./Lib/ctypes/macholib/dyld.py" do |f|
f.gsub! "DEFAULT_LIBRARY_FALLBACK = [",
"DEFAULT_LIBRARY_FALLBACK = [ '#{HOMEBREW_PREFIX}/lib', '#{Formula["openssl@3"].opt_lib}',"
f.gsub! "DEFAULT_FRAMEWORK_FALLBACK = [", "DEFAULT_FRAMEWORK_FALLBACK = [ '#{HOMEBREW_PREFIX}/Frameworks',"
end
args << "CFLAGS=#{cflags.join(" ")}" unless cflags.empty?
args << "CFLAGS_NODIST=#{cflags_nodist.join(" ")}" unless cflags_nodist.empty?
args << "LDFLAGS=#{ldflags.join(" ")}" unless ldflags.empty?
args << "LDFLAGS_NODIST=#{ldflags_nodist.join(" ")}" unless ldflags_nodist.empty?
args << "CPPFLAGS=#{cppflags.join(" ")}" unless cppflags.empty?
# Disabled modules - provided in separate formulae
args += %w[
py_cv_module__tkinter=n/a
]
system "./configure", *args
system "make"
ENV.deparallelize do
# The `altinstall` target prevents the installation of files with only Python's major
# version in its name. This allows us to link multiple versioned Python formulae.
# https://github.com/python/cpython#installing-multiple-versions
#
# Tell Python not to install into /Applications (default for framework builds)
target = "#{"alt" if altinstall?}install"
system "make", target, "PYTHONAPPSDIR=#{prefix}"
system "make", "frameworkinstallextras", "PYTHONAPPSDIR=#{pkgshare}" if OS.mac?
end
if OS.mac?
# Any .app get a " 3" attached, so it does not conflict with python 2.x.
prefix.glob("*.app") { |app| mv app, app.to_s.sub(/\.app$/, " 3.app") }
pc_dir = frameworks/"Python.framework/Versions"/version.major_minor/"lib/pkgconfig"
# Symlink the pkgconfig files into HOMEBREW_PREFIX so they're accessible.
(lib/"pkgconfig").install_symlink pc_dir.children
# Prevent third-party packages from building against fragile Cellar paths
bad_cellar_path_files = [
lib_cellar/"_sysconfigdata__darwin_darwin.py",
lib_cellar/"config-#{version.major_minor}-darwin/Makefile",
pc_dir/"python-#{version.major_minor}.pc",
pc_dir/"python-#{version.major_minor}-embed.pc",
]
inreplace bad_cellar_path_files, prefix, opt_prefix
# Help third-party packages find the Python framework
inreplace lib_cellar/"config-#{version.major_minor}-darwin/Makefile",
/^LINKFORSHARED=(.*)PYTHONFRAMEWORKDIR(.*)/,
"LINKFORSHARED=\\1PYTHONFRAMEWORKINSTALLDIR\\2"
# Symlink the pkgconfig files into HOMEBREW_PREFIX so they're accessible.
(lib/"pkgconfig").install_symlink pc_dir.children
# Fix for https://github.com/Homebrew/homebrew-core/issues/21212
inreplace lib_cellar/"_sysconfigdata__darwin_darwin.py",
%r{('LINKFORSHARED': .*?) (Python.framework/Versions/3.\d+/Python)'}m,
"\\1 #{opt_prefix}/Frameworks/\\2'"
# For an altinstall, remove symlinks that conflict with the main Python formula.
rm frameworks.glob("Python.framework/{Headers,Python,Resources,Versions/Current}") if altinstall?
else
# Prevent third-party packages from building against fragile Cellar paths
inreplace Dir[lib_cellar/"**/_sysconfigdata_*linux_x86_64-*.py",
lib_cellar/"config*/Makefile",
bin/"python#{version.major_minor}-config",
lib/"pkgconfig/python-3*.pc"],
prefix, opt_prefix
inreplace bin/"python#{version.major_minor}-config",
'prefix_real=$(installed_prefix "$0")',
"prefix_real=#{opt_prefix}"
# For an altinstall, remove symlinks that conflict with the main Python formula.
rm lib/"libpython3.so" if altinstall?
end
# Remove the site-packages that Python created in its Cellar.
rm_r site_packages_cellar.children
# Prepare a wheel of wheel to install later.
common_pip_args = %w[
-v
--no-deps
--no-binary :all:
--no-index
--no-build-isolation
]
whl_build = buildpath/"whl_build"
system python3, "-m", "venv", whl_build
%w[flit-core wheel].each do |r|
resource(r).stage do
system whl_build/"bin/pip3", "install", *common_pip_args, "."
end
end
resource("wheel").stage do
system whl_build/"bin/pip3", "wheel", *common_pip_args,
"--wheel-dir=#{libexec}",
"."
end
# Replace bundled pip with our own.
rm lib_cellar.glob("ensurepip/_bundled/pip-*.whl")
resource("pip").stage do
system whl_build/"bin/pip3", "wheel", *common_pip_args,
"--wheel-dir=#{lib_cellar}/ensurepip/_bundled",
"."
end
# Patch ensurepip to bootstrap our updated version of pip
inreplace lib_cellar/"ensurepip/__init__.py" do |s|
s.gsub!(/_PIP_VERSION = .*/, "_PIP_VERSION = \"#{resource("pip").version}\"")
end
# Ensure that our new pip wheel is globally readable.
chmod "ugo+r", lib_cellar.glob("ensurepip/_bundled/pip-*.whl")
# Install unversioned (and for an altinstall, major-versioned) symlinks in libexec/bin.
{
"idle" => "idle#{version.major_minor}",
"pydoc" => "pydoc#{version.major_minor}",
"python" => "python#{version.major_minor}",
"python-config" => "python#{version.major_minor}-config",
}.merge(altinstall? ? {
"idle3" => "idle#{version.major_minor}",
"pydoc3" => "pydoc#{version.major_minor}",
"python3" => "python#{version.major_minor}",
"python3-config" => "python#{version.major_minor}-config",
} : {}).each do |short_name, long_name|
(libexec/"bin").install_symlink (bin/long_name).realpath => short_name
end
# Bootstrap initial install of pip.
system python3, "-Im", "ensurepip"
# Install desired versions of pip, wheel using the version of
# pip bootstrapped by ensurepip.
# Note that while we replaced the ensurepip wheels, there's no guarantee
# ensurepip actually used them, since other existing installations could
# have been picked up (and we can't pass --ignore-installed).
root_site_packages = lib/"python#{version.major_minor}/site-packages"
bundled = lib_cellar/"ensurepip/_bundled"
system python3, "-Im", "pip", "install", "-v",
"--no-deps",
"--no-index",
"--upgrade",
"--isolated",
"--target=#{root_site_packages}",
bundled/"pip-#{resource("pip").version}-py3-none-any.whl",
libexec/"wheel-#{resource("wheel").version}-py3-none-any.whl"
# pip install with --target flag will just place the bin folder into the
# target, so move its contents into the appropriate location
mv (root_site_packages/"bin").children, bin
rmdir root_site_packages/"bin"
rm bin/"pip"
rm bin/"pip3" if altinstall?
mv bin/"wheel", bin/"wheel#{version.major_minor}"
bin.install_symlink "wheel#{version.major_minor}" => "wheel3" unless altinstall?
# Install unversioned (and for an altinstall, major-versioned) symlinks in libexec/bin.
{
"pip" => "pip#{version.major_minor}",
"wheel" => "wheel#{version.major_minor}",
}.merge(altinstall? ? {
"pip3" => "pip#{version.major_minor}",
"wheel3" => "wheel#{version.major_minor}",
} : {}).each do |short_name, long_name|
(libexec/"bin").install_symlink (bin/long_name).realpath => short_name
end
if OS.mac?
# Replace framework site-packages with a symlink to the real one.
rm_r site_packages_cellar
site_packages_cellar.parent.install_symlink root_site_packages
end
# Write out sitecustomize.py
(lib_cellar/"sitecustomize.py").atomic_write(sitecustomize)
# Mark Homebrew python as externally managed: https://peps.python.org/pep-0668/#marking-an-interpreter-as-using-an-external-package-manager
# Placed after ensurepip since it invokes pip in isolated mode, meaning
# we can't pass --break-system-packages.
(lib_cellar/"EXTERNALLY-MANAGED").write <<~INI
[externally-managed]
Error=To install Python packages system-wide, try brew install
xyz, where xyz is the package you are trying to
install.
If you wish to install a Python library that isn't in Homebrew,
use a virtual environment:
python3 -m venv path/to/venv
source path/to/venv/bin/activate
python3 -m pip install xyz
If you wish to install a Python application that isn't in Homebrew,
it may be easiest to use 'pipx install xyz', which will manage a
virtual environment for you. You can install pipx with
brew install pipx
You may restore the old behavior of pip by passing
the '--break-system-packages' flag to pip, or by adding
'break-system-packages = true' to your pip.conf file. The latter
will permanently disable this error.
If you disable this error, we STRONGLY recommend that you additionally
pass the '--user' flag to pip, or set 'user = true' in your pip.conf
file. Failure to do this can result in a broken Homebrew installation.
Read more about this behavior here: <https://peps.python.org/pep-0668/>
INI
end
def sitecustomize
<<~PYTHON
# This file is created by Homebrew and is executed on each python startup.
# Don't print from here, or else python command line scripts may fail!
# <https://docs.brew.sh/Homebrew-and-Python>
import re
import os
import site
import sys
if sys.version_info[:2] != (#{version.major}, #{version.minor}):
# This can only happen if the user has set the PYTHONPATH to a mismatching site-packages directory.
# Every Python looks at the PYTHONPATH variable and we can't fix it here in sitecustomize.py,
# because the PYTHONPATH is evaluated after the sitecustomize.py. Many modules (e.g. PyQt4) are
# built only for a specific version of Python and will fail with cryptic error messages.
# In the end this means: Don't set the PYTHONPATH permanently if you use different Python versions.
exit(f'Your PYTHONPATH points to a site-packages dir for Python #{version.major_minor} '
f'but you are running Python {sys.version_info[0]}.{sys.version_info[1]}!\\n'
f' PYTHONPATH is currently: "{os.environ["PYTHONPATH"]}"\\n'
f' You should `unset PYTHONPATH` to fix this.')
# Only do this for a brewed python:
if os.path.realpath(sys.executable).startswith('#{rack}'):
# Shuffle /Library site-packages to the end of sys.path
library_site = '/Library/Python/#{version.major_minor}/site-packages'
library_packages = [p for p in sys.path if p.startswith(library_site)]
sys.path = [p for p in sys.path if not p.startswith(library_site)]
# .pth files have already been processed so don't use addsitedir
sys.path.extend(library_packages)
# the Cellar site-packages is a symlink to the HOMEBREW_PREFIX
# site_packages; prefer the shorter paths
long_prefix = re.compile(r'#{rack}/[0-9\\._abrc]+/(?:Frameworks/Python\\.framework/Versions/#{version.major_minor}/)?lib/python#{version.major_minor}/site-packages')
sys.path = [long_prefix.sub('#{site_packages}', p) for p in sys.path]
# Set the sys.executable to use the opt_prefix. Only do this if PYTHONEXECUTABLE is not
# explicitly set and we are not in a virtualenv:
if 'PYTHONEXECUTABLE' not in os.environ and sys.prefix == sys.base_prefix:
sys.executable = sys._base_executable = '#{opt_bin}/python#{version.major_minor}'
if 'PYTHONHOME' not in os.environ:
cellar_prefix = re.compile(r'#{rack}/[0-9\\._abrc]+(?=/|$)')
if os.path.realpath(sys.base_prefix).startswith('#{rack}'):
new_prefix = cellar_prefix.sub('#{opt_prefix}', sys.base_prefix)
site.PREFIXES[:] = [new_prefix if x == sys.base_prefix else x for x in site.PREFIXES]
if sys.prefix == sys.base_prefix:
sys.prefix = new_prefix
sys.base_prefix = new_prefix
if os.path.realpath(sys.base_exec_prefix).startswith('#{rack}'):
new_exec_prefix = cellar_prefix.sub('#{opt_prefix}', sys.base_exec_prefix)
site.PREFIXES[:] = [new_exec_prefix if x == sys.base_exec_prefix else x for x in site.PREFIXES]
if sys.exec_prefix == sys.base_exec_prefix:
sys.exec_prefix = new_exec_prefix
sys.base_exec_prefix = new_exec_prefix
# Make site.getsitepackages() return the HOMEBREW_PREFIX site-packages,
# but only if we are outside a venv or in one with include-system-site-packages.
if sys.base_prefix in site.PREFIXES:
site.PREFIXES.insert(site.PREFIXES.index(sys.base_prefix), '#{HOMEBREW_PREFIX}')
site.addsitedir('#{site_packages}')
# Check for and add the prefix of split Python formulae.
for split_module in ["tk", "gdbm"]:
split_prefix = f"#{HOMEBREW_PREFIX}/opt/python-{split_module}@#{version.major_minor}/libexec"
if os.path.isdir(split_prefix):
sys.path.append(split_prefix)
PYTHON
end
def caveats
dbm_is = "`dbm.gnu` is"
on_linux do
dbm_is = "`dbm.gnu` and `dbm.ndbm` are"
end
<<~EOS
Python is installed as
#{HOMEBREW_PREFIX}/bin/python#{version.major_minor}
Unversioned and major-versioned symlinks `python`, `python3`, `python-config`, `python3-config`, `pip`, `pip3`, etc. pointing to
`python#{version.major_minor}`, `python#{version.major_minor}-config`, `pip#{version.major_minor}` etc., respectively, are installed into
#{opt_libexec}/bin
If you do not need a specific version of Python, and always want Homebrew's `python3` in your PATH:
brew install python3
`idle#{version.major_minor}` requires tkinter, which is available separately:
brew install python-tk@#{version.major_minor}
#{dbm_is} available separately:
brew install python-gdbm@#{version.major_minor}
For more information about Homebrew and Python, see: https://docs.brew.sh/Homebrew-and-Python
EOS
end
test do
# Check if sqlite is ok, because we build with --enable-loadable-sqlite-extensions
# and it can occur that building sqlite silently fails if OSX's sqlite is used.
system python3, "-c", "import sqlite3"
# check to see if we can create a venv
system python3, "-m", "venv", testpath/"myvenv"
# Check if some other modules import. Then the linked libs are working.
system python3, "-c", "import _ctypes"
system python3, "-c", "import _decimal"
system python3, "-c", "import pyexpat"
system python3, "-c", "import readline"
system python3, "-c", "import zlib"
# tkinter is provided in a separate formula
assert_match "ModuleNotFoundError: No module named '_tkinter'",
shell_output("#{python3} -Sc 'import tkinter' 2>&1", 1)
# gdbm is provided in a separate formula
assert_match "ModuleNotFoundError: No module named '_gdbm'",
shell_output("#{python3} -Sc 'import _gdbm' 2>&1", 1)
assert_match "ModuleNotFoundError: No module named '_gdbm'",
shell_output("#{python3} -Sc 'import dbm.gnu' 2>&1", 1)
# Verify that the selected DBM interface works on macOS.
# Linux requires installing python-gdbm formula
(testpath/"dbm_test.py").write <<~PYTHON
import dbm
with dbm.ndbm.open("test", "c") as db:
db[b"foo \\xbd"] = b"bar \\xbd"
with dbm.ndbm.open("test", "r") as db:
assert list(db.keys()) == [b"foo \\xbd"]
assert b"foo \\xbd" in db
assert db[b"foo \\xbd"] == b"bar \\xbd"
PYTHON
system python3, "dbm_test.py" if OS.mac?
system bin/"pip#{version.major_minor}", "list", "--format=columns"
# Check our sitecustomize.py
assert_match HOMEBREW_CELLAR.to_s, shell_output("#{python3} -Sc 'import sys; print(sys.base_prefix)'")
refute_match HOMEBREW_CELLAR.to_s, shell_output("#{python3} -c 'import sys; print(sys.base_prefix)'")
refute_match site_packages_cellar.to_s, shell_output("#{python3} -c 'import sys; print(sys.path)'")
# Verify our sysconfig patches
sysconfig_path = "import sysconfig; print(sysconfig.get_paths(\"osx_framework_library\")[\"data\"])"
assert_equal HOMEBREW_PREFIX.to_s, shell_output("#{python3} -c '#{sysconfig_path}'").strip
linkforshared_var = "import sysconfig; print(sysconfig.get_config_var(\"LINKFORSHARED\"))"
assert_match opt_prefix.to_s, shell_output("#{python3} -c '#{linkforshared_var}'") if OS.mac?
# Check our externally managed marker
assert_match "If you wish to install a Python library",
shell_output("#{python3} -m pip install pip 2>&1", 1)
end
end
+539
View File
@@ -0,0 +1,539 @@
# frozen_string_literal: true
# Generated by generate_tap.py for local/mirror
class PythonAT314 < Formula
desc "Interpreted, interactive, object-oriented programming language"
homepage "https://www.python.org/"
url "https://homebrew.mirror.ygg/sources/2b4e7dff0f6a16963a67a23ebc57091b355497b33c7cff55596b5349c23a6b56--python@3.14--3.14.6.x86_64_linux.bottle.tar.gz"
sha256 "74d0d71d0600e477651a077101d6e62d1e2e69b8e992ba18c993dd643b7ba222"
license "Python-2.0"
compatibility_version 1
livecheck do
url "https://www.python.org/downloads/source/"
regex(%r{href=.*?/Python[._-]v?(3\.14(?:\.\d+)*)\.t}i)
end
bottle do
root_url "https://homebrew.mirror.ygg/bottles"
sha256 arm64_tahoe: "92810d5e3f7e47b9b49c1bca6fb4d9f3cefbb90c77669f4e6785d0babcc1c1b9"
sha256 arm64_sequoia: "76505a94aa16b62f002671c0a81c64b4704adcdf05411f3e0a386b3c8610c477"
sha256 arm64_sonoma: "41f0fac6d489a149fd99687d96832a9b2b3948a1924140cec812a98752584109"
sha256 tahoe: "82e86b7276eeaf4cf1f336d2732be2ab8915bb92b71ee63609b9cb3a022f9a93"
sha256 sequoia: "7e04ab45b53a87720413627558e8c72ee44aa6991a300903b6b600a49b793c17"
sha256 sonoma: "564b57b5759f74940b826353d37b9e0c0767ff0a663d321330a673e0138b136a"
sha256 arm64_linux: "c7bc359fda22b9bd1083e2b23b2a0e5f235a7ee71aa02751d2d11287d423cd33"
sha256 x86_64_linux: "4bdc2a2fda5f6c7c5307a3bb9d8d33d5fb79d5d1c72c79a7fb1b32a53e68bd1b"
end
depends_on "pkgconf" => :build
depends_on "mpdecimal"
depends_on "openssl@3"
depends_on "sqlite"
depends_on "xz"
depends_on "zstd"
uses_from_macos "bzip2"
uses_from_macos "expat", since: :sequoia
uses_from_macos "libedit"
uses_from_macos "libffi"
uses_from_macos "ncurses"
uses_from_macos "unzip"
on_linux do
depends_on "zlib-ng-compat"
end
link_overwrite "bin/idle3"
link_overwrite "bin/pip3"
link_overwrite "bin/pydoc3"
link_overwrite "bin/python3"
link_overwrite "bin/python3-config"
link_overwrite "bin/wheel3"
link_overwrite "share/man/man1/python3.1"
link_overwrite "lib/libpython3.so"
link_overwrite "lib/pkgconfig/python3.pc"
link_overwrite "lib/pkgconfig/python3-embed.pc"
link_overwrite "lib/python3.14/site-packages/pip*"
link_overwrite "lib/python3.14/site-packages/wheel*"
link_overwrite "Frameworks/Python.framework/Headers"
link_overwrite "Frameworks/Python.framework/Python"
link_overwrite "Frameworks/Python.framework/Resources"
link_overwrite "Frameworks/Python.framework/Versions/Current"
pypi_packages package_name: "",
extra_packages: %w[flit-core pip wheel]
resource "flit-core" do
url "https://files.pythonhosted.org/packages/69/59/b6fc2188dfc7ea4f936cd12b49d707f66a1cb7a1d2c16172963534db741b/flit_core-3.12.0.tar.gz"
sha256 "18f63100d6f94385c6ed57a72073443e1a71a4acb4339491615d0f16d6ff01b2"
end
resource "packaging" do
url "https://files.pythonhosted.org/packages/d7/f1/e7a6dd94a8d4a5626c03e4e99c87f241ba9e350cd9e6d75123f992427270/packaging-26.2.tar.gz"
sha256 "ff452ff5a3e828ce110190feff1178bb1f2ea2281fa2075aadb987c2fb221661"
end
resource "pip" do
url "https://files.pythonhosted.org/packages/01/91/47e7d486260f618783899587af63ccf7980fb60245c3e63dd4571c6b57ad/pip-26.1.2.tar.gz"
sha256 "f49cd134c61cf2fd75e0ce2676db03e4054504a5a4986d00f8299ae632dc4605"
end
resource "wheel" do
url "https://files.pythonhosted.org/packages/39/62/75f18a0f03b4219c456652c7780e4d749b929eb605c098ce3a5b6b6bc081/wheel-0.47.0.tar.gz"
sha256 "cc72bd1009ba0cf63922e28f94d9d83b920aa2bb28f798a31d0691b02fa3c9b3"
end
# Modify default sysconfig to match the brew install layout.
# Remove when a non-patching mechanism is added (https://bugs.python.org/issue43976).
# We (ab)use osx_framework_library to exploit pip behaviour to allow --prefix to still work.
patch do
url "https://raw.githubusercontent.com/Homebrew/homebrew-core/1cf441a0/Patches/python/3.13-sysconfig.diff"
sha256 "9f2eae1d08720b06ac3d9ef1999c09388b9db39dfb52687fc261ff820bff20c3"
end
def lib_cellar
on_macos do
return frameworks/"Python.framework/Versions"/version.major_minor/"lib/python#{version.major_minor}"
end
on_linux do
return lib/"python#{version.major_minor}"
end
end
def site_packages_cellar = lib_cellar/"site-packages"
# The HOMEBREW_PREFIX location of site-packages.
def site_packages = HOMEBREW_PREFIX/"lib/python#{version.major_minor}/site-packages"
def altinstall? = name != Formula["python3"].name
def python3 = bin/"python#{version.major_minor}"
deny_network_access!
def install
# Unset these so that installing pip and setuptools puts them where we want
# and not into some other Python the user has installed.
ENV["PYTHONHOME"] = nil
ENV["PYTHONPATH"] = nil
# Override the auto-detection of libmpdec, which assumes a universal build.
# This is currently an inreplace due to https://github.com/python/cpython/issues/98557.
if OS.mac?
inreplace "configure", "libmpdec_machine=universal",
"libmpdec_machine=#{ENV["PYTHON_DECIMAL_WITH_MACHINE"] = Hardware::CPU.arm? ? "uint128" : "x64"}"
end
# The --enable-optimization and --with-lto flags diverge from what upstream
# python does for their macOS binary releases. They have chosen not to apply
# these flags because they want one build that will work across many macOS
# releases. Homebrew is not so constrained because the bottling
# infrastructure specializes for each macOS major release.
args = %W[
--prefix=#{prefix}
--enable-ipv6
--datarootdir=#{share}
--datadir=#{share}
--without-ensurepip
--enable-loadable-sqlite-extensions
--with-openssl=#{Formula["openssl@3"].opt_prefix}
--enable-optimizations
--with-system-expat
--with-system-libmpdec
--with-readline=editline
]
# Python re-uses flags when building native modules.
# Since we don't want native modules prioritizing the brew
# include path, we move them to [C|LD]FLAGS_NODIST.
# Note: Changing CPPFLAGS causes issues with dbm, so we
# leave it as-is.
cflags = []
cflags_nodist = ["-I#{HOMEBREW_PREFIX}/include"]
ldflags = []
ldflags_nodist = ["-L#{HOMEBREW_PREFIX}/lib", "-Wl,-rpath,#{HOMEBREW_PREFIX}/lib"]
cppflags = ["-I#{HOMEBREW_PREFIX}/include"]
if OS.mac?
# Enabling LTO on Linux makes libpython3.*.a unusable for anyone whose GCC
# install does not match the one in CI _exactly_ (major and minor version).
# https://github.com/orgs/Homebrew/discussions/3734
args << "--with-lto"
args << "--enable-framework=#{frameworks}"
args << "--with-dtrace"
args << "--with-dbmliborder=ndbm"
# Avoid linking to libgcc https://mail.python.org/pipermail/python-dev/2012-February/116205.html
args << "MACOSX_DEPLOYMENT_TARGET=#{MacOS.version}"
else
args << "--enable-shared"
args << "--with-dbmliborder="
end
# Allow python modules to use ctypes.find_library to find homebrew's stuff
# even if homebrew is not a /usr/local/lib. Try this with:
# `brew install enchant && pip install pyenchant`
inreplace "./Lib/ctypes/macholib/dyld.py" do |f|
f.gsub! "DEFAULT_LIBRARY_FALLBACK = [",
"DEFAULT_LIBRARY_FALLBACK = [ '#{HOMEBREW_PREFIX}/lib', '#{Formula["openssl@3"].opt_lib}',"
f.gsub! "DEFAULT_FRAMEWORK_FALLBACK = [", "DEFAULT_FRAMEWORK_FALLBACK = [ '#{HOMEBREW_PREFIX}/Frameworks',"
end
args << "CFLAGS=#{cflags.join(" ")}" unless cflags.empty?
args << "CFLAGS_NODIST=#{cflags_nodist.join(" ")}" unless cflags_nodist.empty?
args << "LDFLAGS=#{ldflags.join(" ")}" unless ldflags.empty?
args << "LDFLAGS_NODIST=#{ldflags_nodist.join(" ")}" unless ldflags_nodist.empty?
args << "CPPFLAGS=#{cppflags.join(" ")}" unless cppflags.empty?
# Disabled modules - provided in separate formulae
args += %w[
py_cv_module__tkinter=n/a
]
system "./configure", *args
system "make"
ENV.deparallelize do
# The `altinstall` target prevents the installation of files with only Python's major
# version in its name. This allows us to link multiple versioned Python formulae.
# https://github.com/python/cpython#installing-multiple-versions
#
# Tell Python not to install into /Applications (default for framework builds)
target = "#{"alt" if altinstall?}install"
system "make", target, "PYTHONAPPSDIR=#{prefix}"
system "make", "frameworkinstallextras", "PYTHONAPPSDIR=#{pkgshare}" if OS.mac?
end
if OS.mac?
# Any .app get a " 3" attached, so it does not conflict with python 2.x.
prefix.glob("*.app") { |app| mv app, app.to_s.sub(/\.app$/, " 3.app") }
pc_dir = frameworks/"Python.framework/Versions"/version.major_minor/"lib/pkgconfig"
# Symlink the pkgconfig files into HOMEBREW_PREFIX so they're accessible.
(lib/"pkgconfig").install_symlink pc_dir.children
# Prevent third-party packages from building against fragile Cellar paths
bad_cellar_path_files = [
lib_cellar/"_sysconfigdata__darwin_darwin.py",
lib_cellar/"_sysconfig_vars__darwin_darwin.json",
lib_cellar/"config-#{version.major_minor}-darwin/Makefile",
pc_dir/"python-#{version.major_minor}.pc",
pc_dir/"python-#{version.major_minor}-embed.pc",
]
inreplace bad_cellar_path_files, prefix, opt_prefix
# Help third-party packages find the Python framework
inreplace lib_cellar/"config-#{version.major_minor}-darwin/Makefile",
/^LINKFORSHARED=(.*)PYTHONFRAMEWORKDIR(.*)/,
"LINKFORSHARED=\\1PYTHONFRAMEWORKINSTALLDIR\\2"
# Symlink the pkgconfig files into HOMEBREW_PREFIX so they're accessible.
(lib/"pkgconfig").install_symlink pc_dir.children
# Fix for https://github.com/Homebrew/homebrew-core/issues/21212
inreplace lib_cellar/"_sysconfigdata__darwin_darwin.py",
%r{('LINKFORSHARED': .*?) (Python.framework/Versions/3.\d+/Python)'}m,
"\\1 #{opt_prefix}/Frameworks/\\2'"
# For an altinstall, remove symlinks that conflict with the main Python formula.
rm frameworks.glob("Python.framework/{Headers,Python,Resources,Versions/Current}") if altinstall?
else
# Prevent third-party packages from building against fragile Cellar paths
inreplace Dir[lib_cellar/"**/_sysconfigdata_*linux_x86_64-*.py",
lib_cellar/"config*/Makefile",
bin/"python#{version.major_minor}-config",
lib/"pkgconfig/python-3*.pc"],
prefix, opt_prefix
inreplace bin/"python#{version.major_minor}-config",
'prefix_real=$(installed_prefix "$0")',
"prefix_real=#{opt_prefix}"
# For an altinstall, remove symlinks that conflict with the main Python formula.
rm lib/"libpython3.so" if altinstall?
end
# Remove the site-packages that Python created in its Cellar.
rm_r site_packages_cellar.children
# Prepare a wheel of wheel to install later.
common_pip_args = %w[
-v
--no-deps
--no-binary :all:
--no-index
--no-build-isolation
]
whl_build = buildpath/"whl_build"
system python3, "-m", "venv", whl_build
%w[flit-core wheel].each do |r|
resource(r).stage do
system whl_build/"bin/pip3", "install", *common_pip_args, "."
end
end
resource("wheel").stage do
system whl_build/"bin/pip3", "wheel", *common_pip_args,
"--wheel-dir=#{libexec}",
"."
end
# Replace bundled pip with our own.
rm lib_cellar.glob("ensurepip/_bundled/pip-*.whl")
resource("pip").stage do
system whl_build/"bin/pip3", "wheel", *common_pip_args,
"--wheel-dir=#{lib_cellar}/ensurepip/_bundled",
"."
end
# Patch ensurepip to bootstrap our updated version of pip
inreplace lib_cellar/"ensurepip/__init__.py" do |s|
s.gsub!(/_PIP_VERSION = .*/, "_PIP_VERSION = \"#{resource("pip").version}\"")
end
# Ensure that our new pip wheel is globally readable.
chmod "ugo+r", lib_cellar.glob("ensurepip/_bundled/pip-*.whl")
# Install unversioned (and for an altinstall, major-versioned) symlinks in libexec/bin.
{
"idle" => "idle#{version.major_minor}",
"pydoc" => "pydoc#{version.major_minor}",
"python" => "python#{version.major_minor}",
"python-config" => "python#{version.major_minor}-config",
}.merge(altinstall? ? {
"idle3" => "idle#{version.major_minor}",
"pydoc3" => "pydoc#{version.major_minor}",
"python3" => "python#{version.major_minor}",
"python3-config" => "python#{version.major_minor}-config",
} : {}).each do |short_name, long_name|
(libexec/"bin").install_symlink (bin/long_name).realpath => short_name
end
# Bootstrap initial install of pip.
system python3, "-Im", "ensurepip"
# Install desired versions of pip, wheel using the version of
# pip bootstrapped by ensurepip.
# Note that while we replaced the ensurepip wheels, there's no guarantee
# ensurepip actually used them, since other existing installations could
# have been picked up (and we can't pass --ignore-installed).
root_site_packages = lib/"python#{version.major_minor}/site-packages"
bundled = lib_cellar/"ensurepip/_bundled"
system python3, "-Im", "pip", "install", "-v",
"--no-deps",
"--no-index",
"--upgrade",
"--isolated",
"--target=#{root_site_packages}",
bundled/"pip-#{resource("pip").version}-py3-none-any.whl",
libexec/"wheel-#{resource("wheel").version}-py3-none-any.whl"
# pip install with --target flag will just place the bin folder into the
# target, so move its contents into the appropriate location
mv (root_site_packages/"bin").children, bin
rmdir root_site_packages/"bin"
rm bin/"pip"
rm bin/"pip3" if altinstall?
mv bin/"wheel", bin/"wheel#{version.major_minor}"
bin.install_symlink "wheel#{version.major_minor}" => "wheel3" unless altinstall?
# Install unversioned (and for an altinstall, major-versioned) symlinks in libexec/bin.
{
"pip" => "pip#{version.major_minor}",
"wheel" => "wheel#{version.major_minor}",
}.merge(altinstall? ? {
"pip3" => "pip#{version.major_minor}",
"wheel3" => "wheel#{version.major_minor}",
} : {}).each do |short_name, long_name|
(libexec/"bin").install_symlink (bin/long_name).realpath => short_name
end
if OS.mac?
# Replace framework site-packages with a symlink to the real one.
rm_r site_packages_cellar
site_packages_cellar.parent.install_symlink root_site_packages
end
# Write out sitecustomize.py
(lib_cellar/"sitecustomize.py").atomic_write(sitecustomize)
# Mark Homebrew python as externally managed: https://peps.python.org/pep-0668/#marking-an-interpreter-as-using-an-external-package-manager
# Placed after ensurepip since it invokes pip in isolated mode, meaning
# we can't pass --break-system-packages.
(lib_cellar/"EXTERNALLY-MANAGED").write <<~INI
[externally-managed]
Error=To install Python packages system-wide, try brew install
xyz, where xyz is the package you are trying to
install.
If you wish to install a Python library that isn't in Homebrew,
use a virtual environment:
python3 -m venv path/to/venv
source path/to/venv/bin/activate
python3 -m pip install xyz
If you wish to install a Python application that isn't in Homebrew,
it may be easiest to use 'pipx install xyz', which will manage a
virtual environment for you. You can install pipx with
brew install pipx
You may restore the old behavior of pip by passing
the '--break-system-packages' flag to pip, or by adding
'break-system-packages = true' to your pip.conf file. The latter
will permanently disable this error.
If you disable this error, we STRONGLY recommend that you additionally
pass the '--user' flag to pip, or set 'user = true' in your pip.conf
file. Failure to do this can result in a broken Homebrew installation.
Read more about this behavior here: <https://peps.python.org/pep-0668/>
INI
end
def sitecustomize
<<~PYTHON
# This file is created by Homebrew and is executed on each python startup.
# Don't print from here, or else python command line scripts may fail!
# <https://docs.brew.sh/Homebrew-and-Python>
import re
import os
import site
import sys
if sys.version_info[:2] != (#{version.major}, #{version.minor}):
# This can only happen if the user has set the PYTHONPATH to a mismatching site-packages directory.
# Every Python looks at the PYTHONPATH variable and we can't fix it here in sitecustomize.py,
# because the PYTHONPATH is evaluated after the sitecustomize.py. Many modules (e.g. PyQt4) are
# built only for a specific version of Python and will fail with cryptic error messages.
# In the end this means: Don't set the PYTHONPATH permanently if you use different Python versions.
exit(f'Your PYTHONPATH points to a site-packages dir for Python #{version.major_minor} '
f'but you are running Python {sys.version_info[0]}.{sys.version_info[1]}!\\n'
f' PYTHONPATH is currently: "{os.environ["PYTHONPATH"]}"\\n'
f' You should `unset PYTHONPATH` to fix this.')
# Only do this for a brewed python:
if os.path.realpath(sys.executable).startswith('#{rack}'):
# Shuffle /Library site-packages to the end of sys.path
library_site = '/Library/Python/#{version.major_minor}/site-packages'
library_packages = [p for p in sys.path if p.startswith(library_site)]
sys.path = [p for p in sys.path if not p.startswith(library_site)]
# .pth files have already been processed so don't use addsitedir
sys.path.extend(library_packages)
# the Cellar site-packages is a symlink to the HOMEBREW_PREFIX
# site_packages; prefer the shorter paths
long_prefix = re.compile(r'#{rack}/[0-9\\._abrc]+/(?:Frameworks/Python\\.framework/Versions/#{version.major_minor}/)?lib/python#{version.major_minor}/site-packages')
sys.path = [long_prefix.sub('#{site_packages}', p) for p in sys.path]
# Set the sys.executable to use the opt_prefix. Only do this if PYTHONEXECUTABLE is not
# explicitly set and we are not in a virtualenv:
if 'PYTHONEXECUTABLE' not in os.environ and sys.prefix == sys.base_prefix:
sys.executable = sys._base_executable = '#{opt_bin}/python#{version.major_minor}'
if 'PYTHONHOME' not in os.environ:
cellar_prefix = re.compile(r'#{rack}/[0-9\\._abrc]+(?=/|$)')
if os.path.realpath(sys.base_prefix).startswith('#{rack}'):
new_prefix = cellar_prefix.sub('#{opt_prefix}', sys.base_prefix)
site.PREFIXES[:] = [new_prefix if x == sys.base_prefix else x for x in site.PREFIXES]
if sys.prefix == sys.base_prefix:
sys.prefix = new_prefix
sys.base_prefix = new_prefix
if os.path.realpath(sys.base_exec_prefix).startswith('#{rack}'):
new_exec_prefix = cellar_prefix.sub('#{opt_prefix}', sys.base_exec_prefix)
site.PREFIXES[:] = [new_exec_prefix if x == sys.base_exec_prefix else x for x in site.PREFIXES]
if sys.exec_prefix == sys.base_exec_prefix:
sys.exec_prefix = new_exec_prefix
sys.base_exec_prefix = new_exec_prefix
# Make site.getsitepackages() return the HOMEBREW_PREFIX site-packages,
# but only if we are outside a venv or in one with include-system-site-packages.
if sys.base_prefix in site.PREFIXES:
site.PREFIXES.insert(site.PREFIXES.index(sys.base_prefix), '#{HOMEBREW_PREFIX}')
site.addsitedir('#{site_packages}')
# Check for and add the prefix of split Python formulae.
for split_module in ["tk", "gdbm"]:
split_prefix = f"#{HOMEBREW_PREFIX}/opt/python-{split_module}@#{version.major_minor}/libexec"
if os.path.isdir(split_prefix):
sys.path.append(split_prefix)
PYTHON
end
def caveats
dbm_is = "`dbm.gnu` is"
on_linux do
dbm_is = "`dbm.gnu` and `dbm.ndbm` are"
end
<<~EOS
Python is installed as
#{HOMEBREW_PREFIX}/bin/python3
Unversioned symlinks `python`, `python-config`, `pip` etc. pointing to
`python3`, `python3-config`, `pip3` etc., respectively, are installed into
#{opt_libexec}/bin
`idle#{version.major_minor}` requires tkinter, which is available separately:
brew install python-tk@#{version.major_minor}
#{dbm_is} available separately:
brew install python-gdbm@#{version.major_minor}
For more information about Homebrew and Python, see: https://docs.brew.sh/Homebrew-and-Python
EOS
end
test do
# Check if sqlite is ok, because we build with --enable-loadable-sqlite-extensions
# and it can occur that building sqlite silently fails if OSX's sqlite is used.
system python3, "-c", "import sqlite3"
# check to see if we can create a venv
system python3, "-m", "venv", testpath/"myvenv"
# Check if some other modules import. Then the linked libs are working.
system python3, "-c", "import _ctypes"
system python3, "-c", "import _decimal"
system python3, "-c", "import pyexpat"
system python3, "-c", "import readline"
system python3, "-c", "import zlib"
system python3, "-c", "import _zstd"
# tkinter is provided in a separate formula
assert_match "ModuleNotFoundError: No module named '_tkinter'",
shell_output("#{python3} -Sc 'import tkinter' 2>&1", 1)
# gdbm is provided in a separate formula
assert_match "ModuleNotFoundError: No module named '_gdbm'",
shell_output("#{python3} -Sc 'import _gdbm' 2>&1", 1)
assert_match "ModuleNotFoundError: No module named '_gdbm'",
shell_output("#{python3} -Sc 'import dbm.gnu' 2>&1", 1)
# Verify that the selected DBM interface works on macOS.
# Linux requires installing python-gdbm formula
(testpath/"dbm_test.py").write <<~PYTHON
import dbm
with dbm.ndbm.open("test", "c") as db:
db[b"foo \\xbd"] = b"bar \\xbd"
with dbm.ndbm.open("test", "r") as db:
assert list(db.keys()) == [b"foo \\xbd"]
assert b"foo \\xbd" in db
assert db[b"foo \\xbd"] == b"bar \\xbd"
PYTHON
system python3, "dbm_test.py" if OS.mac?
system bin/"pip#{version.major_minor}", "list", "--format=columns"
# Check our sitecustomize.py
assert_match HOMEBREW_CELLAR.to_s, shell_output("#{python3} -Sc 'import sys; print(sys.base_prefix)'")
refute_match HOMEBREW_CELLAR.to_s, shell_output("#{python3} -c 'import sys; print(sys.base_prefix)'")
refute_match site_packages_cellar.to_s, shell_output("#{python3} -c 'import sys; print(sys.path)'")
# Verify our sysconfig patches
sysconfig_path = "import sysconfig; print(sysconfig.get_paths(\"osx_framework_library\")[\"data\"])"
assert_equal HOMEBREW_PREFIX.to_s, shell_output("#{python3} -c '#{sysconfig_path}'").strip
linkforshared_var = "import sysconfig; print(sysconfig.get_config_var(\"LINKFORSHARED\"))"
assert_match opt_prefix.to_s, shell_output("#{python3} -c '#{linkforshared_var}'") if OS.mac?
# Check our externally managed marker
assert_match "If you wish to install a Python library",
shell_output("#{python3} -m pip install pip 2>&1", 1)
end
end
+44
View File
@@ -0,0 +1,44 @@
# frozen_string_literal: true
# Generated by generate_tap.py for local/mirror
class QwenCode < Formula
desc "AI-powered command-line workflow tool for developers"
homepage "https://github.com/QwenLM/qwen-code"
url "https://homebrew.mirror.ygg/sources/def2deaee4b97c2ac3c6f33b12f10a6f812331ca44a66b4794c26e3bdc4ffb55--qwen-code--0.18.1.x86_64_linux.bottle.tar.gz"
sha256 "e9688d330896ae60fcc70b516fc8af0ea557bf062d298a72664f6e46c8161ac8"
license "Apache-2.0"
bottle do
root_url "https://homebrew.mirror.ygg/bottles"
sha256 cellar: :any, arm64_tahoe: "1741d0a477aec2f08582708272a3566b95a4c93482793b0f11d0ac2179ff574b"
sha256 cellar: :any, arm64_sequoia: "abfdb335763f26fee40d11eff4d9bd0fae3c89acc69478c454473ca1520f43fb"
sha256 cellar: :any, arm64_sonoma: "abfdb335763f26fee40d11eff4d9bd0fae3c89acc69478c454473ca1520f43fb"
sha256 cellar: :any, sonoma: "85ea399704d61bd70310210dc86d19e8cecd3fcbdce58a883b59cdf68cd45eb9"
sha256 cellar: :any_skip_relocation, arm64_linux: "65aaafa2c151f0ee0ac21f6bca637cfdbb680da9c1957b5b56a37eca9bd2e59c"
sha256 cellar: :any_skip_relocation, x86_64_linux: "22ad0543400539d553edfb53bf6d8d66d0150c5f479ae53ab5d8fab2b37861ee"
end
depends_on "node"
depends_on "ripgrep"
def install
system "npm", "install", *std_npm_args
bin.install_symlink libexec.glob("bin/*")
qwen_code = libexec/"lib/node_modules/@qwen-code/qwen-code"
# Remove incompatible pre-built binaries
rm_r(qwen_code/"vendor/ripgrep")
os = OS.mac? ? "darwin" : "linux"
arch = Hardware::CPU.intel? ? "x64" : "arm64"
(qwen_code/"node_modules/node-pty/prebuilds").glob("*").each do |dir|
rm_r(dir) if dir.basename.to_s != "#{os}-#{arch}"
end
end
test do
assert_match version.to_s, shell_output("#{bin}/qwen --version")
assert_match "No MCP servers configured.", shell_output("#{bin}/qwen mcp list")
end
end
+196
View File
@@ -0,0 +1,196 @@
# frozen_string_literal: true
# Generated by generate_tap.py for local/mirror
class Samba < Formula
# Samba can be used to share directories with the guest in QEMU user-mode
# (SLIRP) networking with the `-net nic -net user,smb=/share/this/with/guest`
# option. The shared folder appears in the guest as "\\10.0.2.4\qemu".
desc "SMB/CIFS file, print, and login server for UNIX"
homepage "https://www.samba.org/"
url "https://homebrew.mirror.ygg/sources/0f505b82b79e10482383de0a14a43db4bc3b63f4a7fd696640b132463478a917--samba--4.24.3.x86_64_linux.bottle.tar.gz"
sha256 "4a5e0ed1ea192b798c873d9957c50a5767c10c2767cccb00d56ecc427e94f8e9"
license "GPL-3.0-or-later"
compatibility_version 1
livecheck do
url "https://www.samba.org/samba/download/"
regex(/href=.*?samba[._-]v?(\d+(?:\.\d+)+)\.t/i)
end
bottle do
root_url "https://homebrew.mirror.ygg/bottles"
sha256 arm64_tahoe: "e9bc393d2c9ac4d3a5fddc9e9a74c9becfb93dfa22a9a1e045315dbb2dd2a06a"
sha256 arm64_sequoia: "8029278180944f0a9c9b5bb657431002b254c4b3f8a5e23a087eec08ecc95f65"
sha256 arm64_sonoma: "d314a7839f6c3c8475293fed884ac03e213a32234cace0733528cfe0f788560e"
sha256 sonoma: "861cb0725349028a28a1e3bc4d4ff3e803102aa17108018e7acf4c0e13846963"
sha256 arm64_linux: "62fe2e7677227829f5b97c376779fdb97c0b2a8518ced63920e37f524b4e9b47"
sha256 x86_64_linux: "87ce6ed75cc1857f5df23e5226d4cfa35be6982cb189470d89cf7fead6deca4e"
end
depends_on "bison" => :build
depends_on "cmocka" => :build
depends_on "pkgconf" => :build
depends_on "gnutls"
# icu4c can get linked if detected by pkg-config and there isn't a way to force disable
# without disabling spotlight support. So we just enable the feature for all systems.
depends_on "icu4c@78"
depends_on "krb5"
depends_on "libtasn1"
depends_on "libxcrypt"
depends_on "lmdb"
depends_on "popt"
depends_on "readline"
depends_on "talloc"
depends_on "tdb"
depends_on "tevent"
uses_from_macos "flex" => :build
uses_from_macos "perl" => :build
uses_from_macos "python" => :build # configure requires python3 binary
uses_from_macos "libxcrypt"
on_macos do
depends_on "gettext"
depends_on "openssl@3"
end
on_linux do
depends_on "libtirpc"
depends_on "zlib-ng-compat"
end
conflicts_with "jena", because: "both install `tdbbackup` binaries"
conflicts_with "puzzles", because: "both install `net` binaries"
resource "Parse::Yapp" do
url "https://cpan.metacpan.org/authors/id/W/WB/WBRASWELL/Parse-Yapp-1.21.tar.gz"
sha256 "3810e998308fba2e0f4f26043035032b027ce51ce5c8a52a8b8e340ca65f13e5"
end
# upstream bug report, https://bugzilla.samba.org/show_bug.cgi?id=10791
# https://bugzilla.samba.org/show_bug.cgi?id=10626
# https://bugzilla.samba.org/show_bug.cgi?id=9665
# upstream pr ref, https://gitlab.com/samba-team/samba/-/merge_requests/3902
patch do
url "https://gitlab.com/samba-team/samba/-/commit/a2736fe78a4e75e71b9bc53dc24c36d71b911d2a.diff"
sha256 "7d1bf9eb26211e2ab9e3e67ae32308a3704ff9904ab2369e5d863e079ea8a03f"
end
def install
# Skip building test that fails on ARM with error: initializer element is not a compile-time constant
inreplace "lib/ldb/wscript", /\('test_ldb_comparison_fold',$/, "\\0 enabled=False," if Hardware::CPU.arm?
# avoid `perl module "Parse::Yapp::Driver" not found` error on macOS 10.xx (not required on 11)
if !OS.mac? || MacOS.version < :big_sur
ENV.prepend_create_path "PERL5LIB", buildpath/"lib/perl5"
ENV.prepend_path "PATH", buildpath/"bin"
resource("Parse::Yapp").stage do
system "perl", "Makefile.PL", "INSTALL_BASE=#{buildpath}"
system "make"
system "make", "install"
end
end
ENV.append "LDFLAGS", "-Wl,-rpath,#{lib}/private" if OS.linux?
bundled_libs_list = []
# Upstream (https://github.com/lxin/quic) has no tagged releases, so we would have to add an arbitrary
# commit as a resource. That's not really better than just using the vendored copy. Consider breaking
# it out into a resource or formula once tagged releases become available.
bundled_libs_list << "libquic" if OS.linux?
bundled_libs = bundled_libs_list.empty? ? "NONE" : bundled_libs_list.join(",")
system "./configure",
"--bundled-libraries=#{bundled_libs}",
"--private-libraries=!ldb",
"--disable-cephfs",
"--disable-cups",
"--disable-iprint",
"--disable-glusterfs",
"--disable-python",
"--without-acl-support",
"--without-ad-dc",
"--without-ads",
"--without-ldap",
"--without-libarchive",
"--without-json",
"--without-pam",
"--without-regedit",
"--without-syslog",
"--without-utmp",
"--without-winbind",
"--with-shared-modules=!vfs_snapper",
"--with-system-mitkrb5",
"--prefix=#{prefix}",
"--sysconfdir=#{etc}",
"--localstatedir=#{var}"
system "make"
system "make", "install"
return unless OS.mac?
# macOS has its own SMB daemon as /usr/sbin/smbd, so rename our smbd to samba-dot-org-smbd to avoid conflict.
# samba-dot-org-smbd is used by qemu.rb .
# Rename profiles as well to avoid conflicting with /usr/bin/profiles
mv sbin/"smbd", sbin/"samba-dot-org-smbd"
mv bin/"profiles", bin/"samba-dot-org-profiles"
end
def caveats
on_macos do
<<~EOS
To avoid conflicting with macOS system binaries, some files were installed with non-standard name:
- smbd: #{HOMEBREW_PREFIX}/sbin/samba-dot-org-smbd
- profiles: #{HOMEBREW_PREFIX}/bin/samba-dot-org-profiles
EOS
end
end
test do
smbd = if OS.mac?
sbin/"samba-dot-org-smbd"
else
sbin/"smbd"
end
system smbd, "--build-options", "--configfile=/dev/null"
system smbd, "--version"
mkdir_p "samba/state"
mkdir_p "samba/data"
(testpath/"samba/data/hello").write "hello"
# mimic smb.conf generated by qemu
# https://github.com/qemu/qemu/blob/v6.0.0/net/slirp.c#L862
(testpath/"smb.conf").write <<~CONF
[global]
private dir=#{testpath}/samba/state
interfaces=127.0.0.1
bind interfaces only=yes
pid directory=#{testpath}/samba/state
lock directory=#{testpath}/samba/state
state directory=#{testpath}/samba/state
cache directory=#{testpath}/samba/state
ncalrpc dir=#{testpath}/samba/state/ncalrpc
log file=#{testpath}/samba/state/log.smbd
smb passwd file=#{testpath}/samba/state/smbpasswd
security = user
map to guest = Bad User
load printers = no
printing = bsd
disable spoolss = yes
usershare max shares = 0
[test]
path=#{testpath}/samba/data
read only=no
guest ok=yes
force user=#{ENV["USER"]}
CONF
port = free_port
spawn smbd, "--debug-stdout", "-F", "--configfile=smb.conf", "--port=#{port}", "--debuglevel=4", in: "/dev/null"
sleep 5
mkdir_p "got"
system bin/"smbclient", "-p", port.to_s, "-N", "//127.0.0.1/test", "-c", "get hello #{testpath}/got/hello"
assert_equal "hello", (testpath/"got/hello").read
end
end
+61
View File
@@ -0,0 +1,61 @@
# frozen_string_literal: true
# Generated by generate_tap.py for local/mirror
class Wget < Formula
desc "Internet file retriever"
homepage "https://www.gnu.org/software/wget/"
url "https://homebrew.mirror.ygg/sources/cc6680bcfb85c0ad05318eed7589aacbcb7c3c876417ef91ab975f2d88539016--wget--1.25.0.x86_64_linux.bottle.1.tar.gz"
sha256 "766e48423e79359ea31e41db9e5c289675947a7fcf2efdcedb726ac9d0da3784"
license "GPL-3.0-or-later"
compatibility_version 1
bottle do
root_url "https://homebrew.mirror.ygg/bottles"
rebuild 1
sha256 arm64_tahoe: "03be72d23a113a3273245b3e071667b611ea5d81dab6f52e995a84420d0ed734"
sha256 arm64_sequoia: "d620e085be7df7e93c7a8e6dc98e71b7a2faedbb40e83daae9b823374ee9b09e"
sha256 arm64_sonoma: "0611b16c2d24332fbb48cf1d75717b3ac3fc579a6ddac33ee1acaa791ff12e8e"
sha256 sonoma: "91995d4d44951e981c36879505e8e294d15e46bbd3ef3965caf94d55424e165b"
sha256 arm64_linux: "6c291dba1e71dcfada741192dbf78790c60488d927fa15c82f4bd0901edfa014"
sha256 x86_64_linux: "09603bb2a51e4bdc94a9f4f3e66442ef6e401a2a2d244213066c58cceb686f95"
end
head do
url "https://git.savannah.gnu.org/git/wget.git", branch: "master"
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "xz" => :build
end
depends_on "pkgconf" => :build
depends_on "libidn2"
depends_on "openssl@3"
on_macos do
depends_on "gettext"
depends_on "libunistring"
end
on_linux do
depends_on "util-linux"
depends_on "zlib-ng-compat"
end
def install
system "./bootstrap", "--skip-po" if build.head?
system "./configure", "--prefix=#{prefix}",
"--sysconfdir=#{etc}",
"--with-ssl=openssl",
"--with-libssl-prefix=#{Formula["openssl@3"].opt_prefix}",
"--disable-pcre",
"--disable-pcre2",
"--without-libpsl",
"--without-included-regex"
system "make", "install"
end
test do
system bin/"wget", "-O", File::NULL, "https://google.com"
end
end
+35
View File
@@ -0,0 +1,35 @@
# frozen_string_literal: true
# Generated by generate_tap.py for local/mirror
class Zoxide < Formula
desc "Shell extension to navigate your filesystem faster"
homepage "https://github.com/ajeetdsouza/zoxide"
url "https://homebrew.mirror.ygg/sources/af170cfc7a003e0a79b0fa6a544ce695547e56656c833afeefae82f25bbb169c--zoxide--0.9.9.x86_64_linux.bottle.tar.gz"
sha256 "eddc76e94db58567503a3893ecac77c572f427f3a4eabdfc762f6773abf12c63"
license "MIT"
bottle do
root_url "https://homebrew.mirror.ygg/bottles"
sha256 cellar: :any_skip_relocation, arm64_tahoe: "a82505577d2966650cc8627de4017a136a93b47878292bd655f0e88599220f66"
sha256 cellar: :any_skip_relocation, arm64_sequoia: "d65d45c8afa409ab16b6ebb5408f5ad351467cb61dfc34b10489f4763bc856dc"
sha256 cellar: :any_skip_relocation, arm64_sonoma: "5c86d40f6688a7c7d1716b474d97b09900709ef842215106e4458d8c495a62df"
sha256 cellar: :any_skip_relocation, sonoma: "6f35975692aa8c38f9ae6b3868122ed8710cb35b3c470844b32cf246cbd80944"
sha256 cellar: :any_skip_relocation, arm64_linux: "aa8fb13ba0cd9a26df2de6472b1d6eb944eee0fcde663b0cffd69dc171a9c2ca"
sha256 cellar: :any_skip_relocation, x86_64_linux: "7aa96060fdfce45c0347eccb89f3d9b5cdaf97d43fc71c0f376867d8a26d942e"
end
depends_on "rust" => :build
def install
system "cargo", "install", *std_cargo_args
bash_completion.install "contrib/completions/zoxide.bash" => "zoxide"
zsh_completion.install "contrib/completions/_zoxide"
fish_completion.install "contrib/completions/zoxide.fish"
share.install "man"
end
test do
assert_empty shell_output("#{bin}/zoxide add /").strip
assert_equal "/", shell_output("#{bin}/zoxide query").strip
end
end
+6
View File
@@ -0,0 +1,6 @@
# local/mirror
Generated tap repository.
Formulae live in `Formula/` and casks live in `Casks/`.
Artifacts are expected under `https://homebrew.mirror.ygg/sources`, `https://homebrew.mirror.ygg/bottles`, and `https://homebrew.mirror.ygg/casks`.
+110
View File
@@ -0,0 +1,110 @@
{
"tap_name": "local/mirror",
"mirror_base_url": "https://homebrew.mirror.ygg",
"formulae": [
{
"name": "atuin",
"source_url": "https://homebrew.mirror.ygg/sources/358c49594fdce992e276d27a0f8f2aab40f671f9f089f772331aa6d40cdde689--atuin--18.16.1.x86_64_linux.bottle.1.tar.gz",
"bottles": []
},
{
"name": "clang-format",
"source_url": "https://homebrew.mirror.ygg/sources/c01ebc051b7d6beb690739b66d16f80c2fdd025a38ade481c57108f884e57603--clang-format--22.1.8.x86_64_linux.bottle.tar.gz",
"bottles": []
},
{
"name": "docker-compose",
"source_url": "https://homebrew.mirror.ygg/sources/16f5e2ba5d2056f7cdd2d4fcc9e5a7bb7430cb3fdf0fd50827f7d55a36a0097b--docker-compose--5.1.4.x86_64_linux.bottle.tar.gz",
"bottles": []
},
{
"name": "helm",
"source_url": "https://homebrew.mirror.ygg/sources/7a435808b5b1e80724b1b5af6619dc6a78044f98000f016bc764e927c3b4b56f--helm--4.2.1.x86_64_linux.bottle.tar.gz",
"bottles": []
},
{
"name": "kubernetes-cli",
"source_url": "https://homebrew.mirror.ygg/sources/7902f16cb564f74289964e1bf0f989e6f395847ea9badb9d0fda9468a692a4ad--kubernetes-cli--1.36.2.x86_64_linux.bottle.tar.gz",
"bottles": []
},
{
"name": "mactop",
"source_url": "https://homebrew.mirror.ygg/sources/98986a2c2d16f785a8f5381537a5c4aa494d4cfabdd8d44a5babf5346d0be9d1--mactop-2.1.5.tar.gz",
"bottles": []
},
{
"name": "ncdu",
"source_url": "https://homebrew.mirror.ygg/sources/023b45ac32cdd77be32bff75872f4d8e4bcacc6926f1af6cbc8d6e51563d2fe4--ncdu--2.9.2.x86_64_linux.bottle.tar.gz",
"bottles": []
},
{
"name": "neovim",
"source_url": "https://homebrew.mirror.ygg/sources/d8665733f86fc2a47171eaae9b1bf690d8927e4b61d2b03c086bec20f3c22ab3--neovim--0.12.3.x86_64_linux.bottle.tar.gz",
"bottles": []
},
{
"name": "node",
"source_url": "https://homebrew.mirror.ygg/sources/2baaa903740d0cf96896afa224cac7ebb02309b9d5df3a64f8945660b65f6d4f--node--26.3.0.x86_64_linux.bottle.1.tar.gz",
"bottles": []
},
{
"name": "opencode",
"source_url": "https://homebrew.mirror.ygg/sources/c041605e77383641405cd7d4f4bd42f7f3a1d98b8369eb2420da4e1041ed1fac--opencode--1.17.5.x86_64_linux.bottle.1.tar.gz",
"bottles": []
},
{
"name": "pkgconf",
"source_url": "https://homebrew.mirror.ygg/sources/325cb439c33323ba98a33e8a620cdca8190b3256dfdd768e8bd0a98387970f82--pkgconf--2.5.1.x86_64_linux.bottle.tar.gz",
"bottles": []
},
{
"name": "python@3.12",
"source_url": "https://homebrew.mirror.ygg/sources/2f434a9769faa918245f9fe345fdd92c98e3801d6e4c47ee4ee78ced5ab3cf87--python@3.12--3.12.13_4.x86_64_linux.bottle.tar.gz",
"bottles": []
},
{
"name": "python@3.13",
"source_url": "https://homebrew.mirror.ygg/sources/c5c8e77d9c288bb56de9c8f1a2fb9780e827f6628be6a62085262f45b40b7ae7--python@3.13--3.13.13_1.x86_64_linux.bottle.1.tar.gz",
"bottles": []
},
{
"name": "python@3.14",
"source_url": "https://homebrew.mirror.ygg/sources/2b4e7dff0f6a16963a67a23ebc57091b355497b33c7cff55596b5349c23a6b56--python@3.14--3.14.6.x86_64_linux.bottle.tar.gz",
"bottles": []
},
{
"name": "qwen-code",
"source_url": "https://homebrew.mirror.ygg/sources/def2deaee4b97c2ac3c6f33b12f10a6f812331ca44a66b4794c26e3bdc4ffb55--qwen-code--0.18.1.x86_64_linux.bottle.tar.gz",
"bottles": []
},
{
"name": "samba",
"source_url": "https://homebrew.mirror.ygg/sources/0f505b82b79e10482383de0a14a43db4bc3b63f4a7fd696640b132463478a917--samba--4.24.3.x86_64_linux.bottle.tar.gz",
"bottles": []
},
{
"name": "wget",
"source_url": "https://homebrew.mirror.ygg/sources/cc6680bcfb85c0ad05318eed7589aacbcb7c3c876417ef91ab975f2d88539016--wget--1.25.0.x86_64_linux.bottle.1.tar.gz",
"bottles": []
},
{
"name": "zoxide",
"source_url": "https://homebrew.mirror.ygg/sources/af170cfc7a003e0a79b0fa6a544ce695547e56656c833afeefae82f25bbb169c--zoxide--0.9.9.x86_64_linux.bottle.tar.gz",
"bottles": []
}
],
"casks": [
{
"name": "android-platform-tools",
"url": "https://homebrew.mirror.ygg/casks/android-platform-tools/android-platform-tools--platform-tools_r37.0.0-darwin.zip"
},
{
"name": "claude-code",
"url": "https://homebrew.mirror.ygg/casks/claude-code/claude-code--claude"
},
{
"name": "codex",
"url": "https://homebrew.mirror.ygg/casks/codex/codex--codex-aarch64-apple-darwin.tar.gz"
}
]
}