-
-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Expand file tree
/
Copy pathblack.rb
More file actions
133 lines (108 loc) · 5.85 KB
/
black.rb
File metadata and controls
133 lines (108 loc) · 5.85 KB
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
class Black < Formula
include Language::Python::Virtualenv
desc "Python code formatter"
homepage "https://black.readthedocs.io/en/stable/"
url "https://files.pythonhosted.org/packages/e1/c5/61175d618685d42b005847464b8fb4743a67b1b8fdb75e50e5a96c31a27a/black-26.3.1.tar.gz"
sha256 "2c50f5063a9641c7eed7795014ba37b0f5fa227f3d408b968936e24bc0566b07"
license "MIT"
revision 1
head "https://github.com/psf/black.git", branch: "main"
bottle do
sha256 cellar: :any_skip_relocation, arm64_tahoe: "96118b6e32413b7879c394752f3cb3ef4fd4efc3035daf0da144c063c0e942ee"
sha256 cellar: :any_skip_relocation, arm64_sequoia: "ea8f271ff0f113fd2fd82903d2f87b9ebc0631a9eeff0451a9f01611bfe2530c"
sha256 cellar: :any_skip_relocation, arm64_sonoma: "6fe48c23c3e5998e647b6f945bdfb55fe8a1cb6e8ad1f6bff911ceae087a61b1"
sha256 cellar: :any_skip_relocation, sonoma: "87884189df4bed87a8799a9859be0ae31478ed1a0063c43e7e53f7491c4a27b5"
sha256 cellar: :any_skip_relocation, arm64_linux: "e963e008be247360d59d8f9d7a6de2fd1286ea987fef75ae351cde29f32292ce"
sha256 cellar: :any_skip_relocation, x86_64_linux: "d9d28b297fc52782fda080508702a900e4f1b1de5dac0d1d2cf0178bd385ed8e"
end
depends_on "python@3.14"
pypi_packages package_name: "black[d]"
resource "aiohappyeyeballs" do
url "https://files.pythonhosted.org/packages/26/30/f84a107a9c4331c14b2b586036f40965c128aa4fee4dda5d3d51cb14ad54/aiohappyeyeballs-2.6.1.tar.gz"
sha256 "c3f9d0113123803ccadfdf3f0faa505bc78e6a72d1cc4806cbd719826e943558"
end
resource "aiohttp" do
url "https://files.pythonhosted.org/packages/77/9a/152096d4808df8e4268befa55fba462f440f14beab85e8ad9bf990516918/aiohttp-3.13.5.tar.gz"
sha256 "9d98cc980ecc96be6eb4c1994ce35d28d8b1f5e5208a23b421187d1209dbb7d1"
end
resource "aiosignal" do
url "https://files.pythonhosted.org/packages/61/62/06741b579156360248d1ec624842ad0edf697050bbaf7c3e46394e106ad1/aiosignal-1.4.0.tar.gz"
sha256 "f47eecd9468083c2029cc99945502cb7708b082c232f9aca65da147157b251c7"
end
resource "attrs" do
url "https://files.pythonhosted.org/packages/9a/8e/82a0fe20a541c03148528be8cac2408564a6c9a0cc7e9171802bc1d26985/attrs-26.1.0.tar.gz"
sha256 "d03ceb89cb322a8fd706d4fb91940737b6642aa36998fe130a9bc96c985eff32"
end
resource "click" do
url "https://files.pythonhosted.org/packages/3d/fa/656b739db8587d7b5dfa22e22ed02566950fbfbcdc20311993483657a5c0/click-8.3.1.tar.gz"
sha256 "12ff4785d337a1bb490bb7e9c2b1ee5da3112e94a8622f26a6c77f5d2fc6842a"
end
resource "frozenlist" do
url "https://files.pythonhosted.org/packages/2d/f5/c831fac6cc817d26fd54c7eaccd04ef7e0288806943f7cc5bbf69f3ac1f0/frozenlist-1.8.0.tar.gz"
sha256 "3ede829ed8d842f6cd48fc7081d7a41001a56f1f38603f9d49bf3020d59a31ad"
end
resource "idna" do
url "https://files.pythonhosted.org/packages/6f/6d/0703ccc57f3a7233505399edb88de3cbd678da106337b9fcde432b65ed60/idna-3.11.tar.gz"
sha256 "795dafcc9c04ed0c1fb032c2aa73654d8e8c5023a7df64a53f39190ada629902"
end
resource "multidict" do
url "https://files.pythonhosted.org/packages/1a/c2/c2d94cbe6ac1753f3fc980da97b3d930efe1da3af3c9f5125354436c073d/multidict-6.7.1.tar.gz"
sha256 "ec6652a1bee61c53a3e5776b6049172c53b6aaba34f18c9ad04f82712bac623d"
end
resource "mypy-extensions" do
url "https://files.pythonhosted.org/packages/a2/6e/371856a3fb9d31ca8dac321cda606860fa4548858c0cc45d9d1d4ca2628b/mypy_extensions-1.1.0.tar.gz"
sha256 "52e68efc3284861e772bbcd66823fde5ae21fd2fdb51c62a211403730b916558"
end
resource "packaging" do
url "https://files.pythonhosted.org/packages/65/ee/299d360cdc32edc7d2cf530f3accf79c4fca01e96ffc950d8a52213bd8e4/packaging-26.0.tar.gz"
sha256 "00243ae351a257117b6a241061796684b084ed1c516a08c48a3f7e147a9d80b4"
end
resource "pathspec" do
url "https://files.pythonhosted.org/packages/fa/36/e27608899f9b8d4dff0617b2d9ab17ca5608956ca44461ac14ac48b44015/pathspec-1.0.4.tar.gz"
sha256 "0210e2ae8a21a9137c0d470578cb0e595af87edaa6ebf12ff176f14a02e0e645"
end
resource "platformdirs" do
url "https://files.pythonhosted.org/packages/19/56/8d4c30c8a1d07013911a8fdbd8f89440ef9f08d07a1b50ab8ca8be5a20f9/platformdirs-4.9.4.tar.gz"
sha256 "1ec356301b7dc906d83f371c8f487070e99d3ccf9e501686456394622a01a934"
end
resource "propcache" do
url "https://files.pythonhosted.org/packages/9e/da/e9fc233cf63743258bff22b3dfa7ea5baef7b5bc324af47a0ad89b8ffc6f/propcache-0.4.1.tar.gz"
sha256 "f48107a8c637e80362555f37ecf49abe20370e557cc4ab374f04ec4423c97c3d"
end
resource "pytokens" do
url "https://files.pythonhosted.org/packages/b6/34/b4e015b99031667a7b960f888889c5bd34ef585c85e1cb56a594b92836ac/pytokens-0.4.1.tar.gz"
sha256 "292052fe80923aae2260c073f822ceba21f3872ced9a68bb7953b348e561179a"
end
resource "yarl" do
url "https://files.pythonhosted.org/packages/23/6e/beb1beec874a72f23815c1434518bfc4ed2175065173fb138c3705f658d4/yarl-1.23.0.tar.gz"
sha256 "53b1ea6ca88ebd4420379c330aea57e258408dd0df9af0992e5de2078dc9f5d5"
end
def install
ENV["HATCH_BUILD_HOOK_ENABLE_MYPYC"] = "1"
virtualenv_install_with_resources
generate_completions_from_executable(bin/"black", shell_parameter_format: :click)
end
service do
run opt_bin/"blackd"
keep_alive true
require_root true
working_dir HOMEBREW_PREFIX
log_path var/"log/blackd.log"
error_log_path var/"log/blackd.log"
end
test do
assert_match "compiled: yes", shell_output("#{bin}/black --version")
ENV["LC_ALL"] = "en_US.UTF-8"
(testpath/"black_test.py").write <<~PYTHON
print(
'It works!')
PYTHON
system bin/"black", "black_test.py"
assert_equal 'print("It works!")', (testpath/"black_test.py").read.strip
port = free_port
spawn bin/"blackd", "--bind-host=127.0.0.1", "--bind-port=#{port}"
sleep 10
output = shell_output("curl -s -XPOST localhost:#{port} -d \"print('valid')\"").strip
assert_match 'print("valid")', output
end
end