@@ -30,6 +30,7 @@ class PythonAT38 < Formula
30
30
31
31
depends_on "pkg-config" => :build
32
32
depends_on "gdbm"
33
+ depends_on "mpdecimal"
33
34
depends_on "openssl@1.1"
34
35
depends_on "readline"
35
36
depends_on "sqlite"
@@ -68,12 +69,23 @@ class PythonAT38 < Formula
68
69
end
69
70
end
70
71
72
+ # Link against libmpdec.so.3, update for mpdecimal.h symbol cleanup.
73
+ patch do
74
+ url "https://www.bytereef.org/contrib/decimal-3.8.diff"
75
+ sha256 "104083617f086375974908f619369cd64005d5ffc314038c31b8b49032280148"
76
+ end
77
+
71
78
def install
72
79
# Unset these so that installing pip and setuptools puts them where we want
73
80
# and not into some other Python the user has installed.
74
81
ENV [ "PYTHONHOME" ] = nil
75
82
ENV [ "PYTHONPATH" ] = nil
76
83
84
+ # Override the auto-detection in setup.py, which assumes a universal build.
85
+ on_macos do
86
+ ENV [ "PYTHON_DECIMAL_WITH_MACHINE" ] = Hardware ::CPU . arm? ? "uint128" : "x64"
87
+ end
88
+
77
89
xy = ( buildpath /"configure.ac" ) . read . slice ( /PYTHON_VERSION, (3\. \d )/ , 1 )
78
90
lib_cellar = prefix /"Frameworks/Python.framework/Versions/#{ xy } /lib/python#{ xy } "
79
91
@@ -87,6 +99,7 @@ def install
87
99
--without-ensurepip
88
100
--with-dtrace
89
101
--with-openssl=#{ Formula [ "openssl@1.1" ] . opt_prefix }
102
+ --with-system-libmpdec
90
103
]
91
104
92
105
cflags = [ "-I#{ HOMEBREW_PREFIX } /include" ]
@@ -317,7 +330,7 @@ def caveats
317
330
# and it can occur that building sqlite silently fails if OSX's sqlite is used.
318
331
system "#{ bin } /python#{ xy } " , "-c" , "import sqlite3"
319
332
# Check if some other modules import. Then the linked libs are working.
320
-
333
+ system " #{ bin } /python #{ xy } " , "-c" , "import _decimal"
321
334
system "#{ bin } /python#{ xy } " , "-c" , "import tkinter; root = tkinter.Tk()"
322
335
323
336
system "#{ bin } /python#{ xy } " , "-c" , "import _gdbm"
0 commit comments