-
-
Notifications
You must be signed in to change notification settings - Fork 12.5k
/
python@3.13.rb
512 lines (439 loc) · 21.7 KB
/
python@3.13.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
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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
class PythonAT313 < Formula
desc "Interpreted, interactive, object-oriented programming language"
homepage "https://www.python.org/"
url "https://www.python.org/ftp/python/3.13.1/Python-3.13.1.tgz"
sha256 "1513925a9f255ef0793dbf2f78bb4533c9f184bdd0ad19763fd7f47a400a7c55"
license "Python-2.0"
livecheck do
url "https://www.python.org/ftp/python/"
regex(%r{href=.*?v?(3\.13(?:\.\d+)*)/?["' >]}i)
end
bottle do
sha256 arm64_sequoia: "e9acf7c76a88dadc5ab62935f5a76a1ee850125b295d5dff130c8a04f436627b"
sha256 arm64_sonoma: "1924392f730828c2d34e22a2f865db3fdfdaa69713e5a1618ef07be75740cbdb"
sha256 arm64_ventura: "f12f9cc766b319e552b4c56d8d43aaafd622b8b06005aa44797841995e3aa7c1"
sha256 sonoma: "2e7875c78944fa027fc592633a4f7fa3ce9d859ed48c6f5206eb0d2ed7bd47ad"
sha256 ventura: "a6d7efe6e58df8e7ea587da7b9b307b8fae43f1f915fb740e012ec19297a2199"
sha256 x86_64_linux: "c61b78aa9a8736cfa07854490753daa5231dbe692c693c58e0b67e5d0b33c0cb"
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"
uses_from_macos "libedit"
uses_from_macos "libffi", since: :catalina
uses_from_macos "libxcrypt"
uses_from_macos "ncurses"
uses_from_macos "unzip"
uses_from_macos "zlib"
on_linux do
depends_on "berkeley-db@5"
depends_on "libnsl"
depends_on "libtirpc"
end
link_overwrite "bin/2to3"
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 "Frameworks/Python.framework/Headers"
link_overwrite "Frameworks/Python.framework/Python"
link_overwrite "Frameworks/Python.framework/Resources"
link_overwrite "Frameworks/Python.framework/Versions/Current"
# Always update to latest release
resource "flit-core" do
url "https://files.pythonhosted.org/packages/d5/ae/09427bea9227a33ec834ed5461432752fd5d02b14f93dd68406c91684622/flit_core-3.10.1.tar.gz"
sha256 "66e5b87874a0d6e39691f0e22f09306736b633548670ad3c09ec9db03c5662f7"
end
resource "pip" do
url "https://files.pythonhosted.org/packages/f4/b1/b422acd212ad7eedddaf7981eee6e5de085154ff726459cf2da7c5a184c1/pip-24.3.1.tar.gz"
sha256 "ebcb60557f2aefabc2e0f918751cd24ea0d56d8ec5445fe1807f1d2109660b99"
end
resource "setuptools" do
url "https://files.pythonhosted.org/packages/43/54/292f26c208734e9a7f067aea4a7e282c080750c4546559b58e2e45413ca0/setuptools-75.6.0.tar.gz"
sha256 "8199222558df7c86216af4f84c30e9b34a61d8ba19366cc914424cdbd28252f6"
end
resource "wheel" do
url "https://files.pythonhosted.org/packages/8a/98/2d9906746cdc6a6ef809ae6338005b3f21bb568bea3165cfc6a243fdc25c/wheel-0.45.1.tar.gz"
sha256 "661e1abd9198507b1409a20c02106d9670b2576e916d58f520316666abca6729"
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/formula-patches/8b5bcbb262d1ea4e572bba55043bf7d2341a6821/python/3.13-sysconfig.diff"
sha256 "e1c2699cf3e39731a19207ed69400a67336cda7767aa08f6f46029f26b1d733b"
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"
end
# The HOMEBREW_PREFIX location of site-packages.
def site_packages
HOMEBREW_PREFIX/"lib/python#{version.major_minor}/site-packages"
end
def python3
bin/"python#{version.major_minor}"
end
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=bdb"
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=disabled
]
system "./configure", *args
system "make"
ENV.deparallelize do
# Tell Python not to install into /Applications (default for framework builds)
system "make", "install", "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'"
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}"
end
# Remove the site-packages that Python created in its Cellar.
rm_r(site_packages_cellar)
# 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 setuptools].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")
%w[pip].each do |r|
resource(r).stage do
system whl_build/"bin/pip3", "wheel", *common_pip_args,
"--wheel-dir=#{lib_cellar}/ensurepip/_bundled",
"."
end
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
# Write out sitecustomize.py
(lib_cellar/"sitecustomize.py").atomic_write(sitecustomize)
# Install unversioned 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",
}.each do |short_name, long_name|
(libexec/"bin").install_symlink (bin/long_name).realpath => short_name
end
end
def post_install
ENV.delete "PYTHONPATH"
# Fix up the site-packages so that user-installed Python software survives
# minor updates, such as going from 3.3.2 to 3.3.3:
# Create a site-packages in HOMEBREW_PREFIX/lib/python#{version.major_minor}/site-packages
site_packages.mkpath
# Symlink the prefix site-packages into the cellar.
site_packages_cellar.unlink if site_packages_cellar.exist?
site_packages_cellar.parent.install_symlink site_packages
# Remove old sitecustomize.py. Now stored in the cellar.
rm_r(Dir["#{site_packages}/sitecustomize.py[co]"])
# Remove old setuptools installations that may still fly around and be
# listed in the easy_install.pth. This can break setuptools build with
# zipimport.ZipImportError: bad local file header
# setuptools-0.9.8-py3.3.egg
rm_r(Dir["#{site_packages}/distribute[-_.][0-9]*", "#{site_packages}/distribute"])
rm_r(Dir["#{site_packages}/pip[-_.][0-9]*", "#{site_packages}/pip"])
rm_r(Dir["#{site_packages}/wheel[-_.][0-9]*", "#{site_packages}/wheel"])
(lib_cellar/"EXTERNALLY-MANAGED").unlink if (lib_cellar/"EXTERNALLY-MANAGED").exist?
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).
bundled = lib_cellar/"ensurepip/_bundled"
system python3, "-Im", "pip", "install", "-v",
"--no-deps",
"--no-index",
"--upgrade",
"--isolated",
"--target=#{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 (site_packages/"bin").children, bin
rmdir site_packages/"bin"
rm_r(bin/"pip")
mv bin/"wheel", bin/"wheel#{version.major_minor}"
bin.install_symlink "wheel#{version.major_minor}" => "wheel3"
# Install unversioned symlinks in libexec/bin.
{
"pip" => "pip#{version.major_minor}",
"wheel" => "wheel#{version.major_minor}",
}.each do |short_name, long_name|
(libexec/"bin").install_symlink (bin/long_name).realpath => short_name
end
# post_install happens after link
%W[wheel3 pip3 wheel#{version.major_minor} pip#{version.major_minor}].each do |e|
(HOMEBREW_PREFIX/"bin").install_symlink bin/e
end
# 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)
if sys.prefix == sys.base_prefix:
site.PREFIXES[:] = [new_prefix if x == sys.prefix else x for x in site.PREFIXES]
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)
if sys.exec_prefix == sys.base_exec_prefix:
site.PREFIXES[:] = [new_exec_prefix if x == sys.exec_prefix else x for x in site.PREFIXES]
sys.exec_prefix = new_exec_prefix
sys.base_exec_prefix = new_exec_prefix
# 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
<<~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
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
(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"
system bin/"pip#{version.major_minor}", "list", "--format=columns"
# 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