Skip to content

Commit 29e04b6

Browse files
authored
Merge pull request #251445 from Homebrew/huggingface-cli-arm64-linux
archgw huggingface-cli: add workaround for arm64 linux
2 parents 31d4f6a + 23c031f commit 29e04b6

File tree

2 files changed

+34
-13
lines changed

2 files changed

+34
-13
lines changed

Formula/a/archgw.rb

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ class Archgw < Formula
88
license "Apache-2.0"
99

1010
bottle do
11-
rebuild 1
12-
sha256 cellar: :any, arm64_tahoe: "c10db98bb7361677d43a4502db9f2a23877a163e92697a526c18dc9a6b23833e"
13-
sha256 cellar: :any, arm64_sequoia: "49ba8976c244113c500931442f9754c1e149d74f72121d7d13492f0770f66129"
14-
sha256 cellar: :any, arm64_sonoma: "245bde81d1dd6316fbe1b332c21e52de54d72504d45e3b7148abda2402694295"
15-
sha256 cellar: :any, sonoma: "d7ba09267c8c4291e3d06827101b06d5d2077b00c7d3c8dfa20c414c5a0daaa0"
16-
sha256 cellar: :any_skip_relocation, x86_64_linux: "a642bfb67f3d57a357bd037915d1ace73e08d6fd748f2483d1c7ecedaaf3e419"
11+
rebuild 2
12+
sha256 cellar: :any, arm64_tahoe: "e5c84edea9bf01e6b3940eb1dc7e35a023e408f0f97632ba405d415198f0182f"
13+
sha256 cellar: :any, arm64_sequoia: "bc16076639115dd44dab5600acb31d5c215abe8d1d7a7bc110c8f8029d1b3275"
14+
sha256 cellar: :any, arm64_sonoma: "8cb76c7b2b50d8925888cb8ca4474910058609c48ef683cb9cd8b583bde77fd6"
15+
sha256 cellar: :any, sonoma: "11a828235b4a0a957d336820aec5964e56ba6d1a8537f4704a02b1eeb5134bb2"
16+
sha256 cellar: :any_skip_relocation, x86_64_linux: "b2ebe5a0a8f32d3446f407506fad2b56cb1985b7dd1670992a91e545e76bb06d"
1717
end
1818

1919
depends_on "rust" => :build # for hf-xet, jitter and safetensors
@@ -332,7 +332,17 @@ def install
332332
# Remove after https://github.com/pypa/hatch/pull/1999 is released.
333333
ENV["SOURCE_DATE_EPOCH"] = "1451574000"
334334

335-
venv = virtualenv_install_with_resources
335+
venv = virtualenv_install_with_resources(without: "hf-xet")
336+
337+
resource("hf-xet").stage do
338+
if ENV.effective_arch == :armv8
339+
# Disable sha2-asm which requires a minimum of -march=armv8-a+crypto
340+
inreplace "data/Cargo.toml",
341+
'sha2 = { workspace = true, features = ["asm"] }',
342+
"sha2 = { workspace = true }"
343+
end
344+
venv.pip_install Pathname.pwd
345+
end
336346

337347
# NOTE: This is an exception to our usual policy as building `pytorch` is complicated
338348
site_packages = Language::Python.site_packages(venv.root/"bin/python3")

Formula/h/huggingface-cli.rb

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,12 @@ class HuggingfaceCli < Formula
99
head "https://github.com/huggingface/huggingface_hub.git", branch: "main"
1010

1111
bottle do
12-
sha256 cellar: :any, arm64_tahoe: "87e2cb3e0a978bfb715d9fab4e009fde35e0d7550bf056212694f2c04b51a67a"
13-
sha256 cellar: :any, arm64_sequoia: "fe43d06f7030440cf4f9aa96e5e5d62cc1b64afea8eab667485be4f6acb80281"
14-
sha256 cellar: :any, arm64_sonoma: "a4d3a7db40661d241041ca55583218676d09a074e44ee74cd72b42713bb8e451"
15-
sha256 cellar: :any, sonoma: "1ac123a8df526e94943a92b1bee7a74e93d310043a88478c3c98fe104f4f7ae0"
16-
sha256 cellar: :any_skip_relocation, x86_64_linux: "1e4f4f96ad0979ca3749c98c63e900cb91745f52614a2871879761f3bbcfacb8"
12+
rebuild 1
13+
sha256 cellar: :any, arm64_tahoe: "f589c998d8e6bf0ea92c36782ab6a606d0f9c26bcb70a27127e1968e759af210"
14+
sha256 cellar: :any, arm64_sequoia: "37779da9ced13fe2b691961a72892e76905dd7adce25f9584ae716f1efbe63be"
15+
sha256 cellar: :any, arm64_sonoma: "4c3cec5c45de604797f558ce2fdff1863e48c0c30817a9225610d4baacc1385d"
16+
sha256 cellar: :any, sonoma: "548c795aed25a3a41122fb030ac707c1341e533194a8e13fa8616f1232dee20a"
17+
sha256 cellar: :any_skip_relocation, x86_64_linux: "cb75fca90b64eac0c0ff0bab6bfce3a3ebd02d263a6526ac8af20ced29865ac2"
1718
end
1819

1920
depends_on "pkgconf" => :build
@@ -112,7 +113,17 @@ class HuggingfaceCli < Formula
112113
end
113114

114115
def install
115-
virtualenv_install_with_resources
116+
venv = virtualenv_install_with_resources(without: "hf-xet")
117+
118+
resource("hf-xet").stage do
119+
if ENV.effective_arch == :armv8
120+
# Disable sha2-asm which requires a minimum of -march=armv8-a+crypto
121+
inreplace "data/Cargo.toml",
122+
'sha2 = { workspace = true, features = ["asm"] }',
123+
"sha2 = { workspace = true }"
124+
end
125+
venv.pip_install Pathname.pwd
126+
end
116127
end
117128

118129
test do

0 commit comments

Comments
 (0)