/
liquidctl.rb
95 lines (78 loc) 路 4.21 KB
/
liquidctl.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
class Liquidctl < Formula
include Language::Python::Virtualenv
desc "Cross-platform tool and drivers for liquid coolers and other devices"
homepage "https://github.com/liquidctl/liquidctl"
url "https://files.pythonhosted.org/packages/99/d9/15bfe9dc11f2910b7483693b0bab16a382e5ad16cee657ff8133b7cae56d/liquidctl-1.13.0.tar.gz"
sha256 "ee17241689c0bf3de43cf4d97822e344f5b57513d16dd160e37fa0e389a158c7"
license "GPL-3.0-or-later"
head "https://github.com/liquidctl/liquidctl.git", branch: "main"
bottle do
rebuild 2
sha256 cellar: :any, arm64_sonoma: "7c54bc0b938b78cef979fc14034c240929b954838e69bbc291f71c8e4cd8e54b"
sha256 cellar: :any, arm64_ventura: "332a8e1cc4a9518c7c5195ffb5c3c8705f128091b7ad79d2f97f38195acfcf45"
sha256 cellar: :any, arm64_monterey: "85b3ce0085769094dc23c5f19e97f704ad3d4ac0cd6a01ebd679455bdb012fcd"
sha256 cellar: :any, sonoma: "4d4edbbc35b6940d190a40a4f74106714b0196fc76629fa25cd04ac6d9561559"
sha256 cellar: :any, ventura: "a606ae831d1bca34872b01bde1ca94c4e00fec533f3ba3914852621ad621e17a"
sha256 cellar: :any, monterey: "98e5669050a2f30de6b80954dec7a4991ed313f5cc0662733940a2007439ae39"
sha256 cellar: :any_skip_relocation, x86_64_linux: "3bb5a06123244c9a2ce837725ee1a1d62f5b5e1859a91ffd0f7c65f14f3041c3"
end
depends_on "hidapi"
depends_on "libusb"
depends_on "pillow"
depends_on "python@3.12"
on_linux do
depends_on "i2c-tools"
end
resource "colorlog" do
url "https://files.pythonhosted.org/packages/db/38/2992ff192eaa7dd5a793f8b6570d6bbe887c4fbbf7e72702eb0a693a01c8/colorlog-6.8.2.tar.gz"
sha256 "3e3e079a41feb5a1b64f978b5ea4f46040a94f11f0e8bbb8261e3dbbeca64d44"
end
resource "crcmod" do
url "https://files.pythonhosted.org/packages/6b/b0/e595ce2a2527e169c3bcd6c33d2473c1918e0b7f6826a043ca1245dd4e5b/crcmod-1.7.tar.gz"
sha256 "dc7051a0db5f2bd48665a990d3ec1cc305a466a77358ca4492826f41f283601e"
end
resource "docopt" do
url "https://files.pythonhosted.org/packages/a2/55/8f8cab2afd404cf578136ef2cc5dfb50baa1761b68c9da1fb1e4eed343c9/docopt-0.6.2.tar.gz"
sha256 "49b3a825280bd66b3aa83585ef59c4a8c82f2c8a522dbe754a8bc8d08c85c491"
end
resource "hidapi" do
url "https://files.pythonhosted.org/packages/95/0e/c106800c94219ec3e6b483210e91623117bfafcf1decaff3c422e18af349/hidapi-0.14.0.tar.gz"
sha256 "a7cb029286ced5426a381286526d9501846409701a29c2538615c3d1a612b8be"
# patch to build with Cython 3+, remove in next release
patch do
url "https://github.com/trezor/cython-hidapi/commit/749da6931f57c4c30596de678125648ccfd6e1cd.patch?full_index=1"
sha256 "e3d70eb9850c7be0fdb0c31bf575b33be5c5848def904760a6ca9f4c3824f000"
end
end
resource "pyusb" do
url "https://files.pythonhosted.org/packages/d9/6e/433a5614132576289b8643fe598dd5d51b16e130fd591564be952e15bb45/pyusb-1.2.1.tar.gz"
sha256 "a4cc7404a203144754164b8b40994e2849fde1cfff06b08492f12fff9d9de7b9"
end
resource "setuptools" do
url "https://files.pythonhosted.org/packages/4d/5b/dc575711b6b8f2f866131a40d053e30e962e633b332acf7cd2c24843d83d/setuptools-69.2.0.tar.gz"
sha256 "0ff4183f8f42cd8fa3acea16c45205521a4ef28f73c6391d8a25e92893134f2e"
end
def install
python3 = "python3.12"
venv = virtualenv_create(libexec, python3)
# Use brewed hidadpi: https://github.com/trezor/cython-hidapi/issues/54
# TODO: For hidapi>0.14, replace with ENV["HIDAPI_SYSTEM_HIDAPI"] = ENV["HIDAPI_WITH_LIBUSB"] = "1"
resource("hidapi").stage do
inreplace "setup.py" do |s|
s.gsub! "system_hidapi = 0", "system_hidapi = 1"
s.gsub! "/usr/include/hidapi", "#{Formula["hidapi"].opt_include}/hidapi"
end
venv.pip_install Pathname.pwd
end
venv.pip_install resources.reject { |r| r.name == "hidapi" }
venv.pip_install_and_link buildpath
man_page = buildpath/"liquidctl.8"
# setting the is_macos register to 1 adjusts the man page for macOS
inreplace man_page, ".nr is_macos 0", ".nr is_macos 1" if OS.mac?
man8.install man_page
(lib/"udev/rules.d").install Dir["extra/linux/*.rules"] if OS.linux?
end
test do
shell_output "#{bin}/liquidctl list --verbose --debug"
end
end