@@ -79,7 +79,24 @@ async function findlibs(): Promise<string[]> {
79
79
libs . concat ( await search ( location ) ) ;
80
80
}
81
81
} else {
82
- for ( const path of [ "/usr/lib" , "/lib" ] ) {
82
+ const paths = [ "/usr/lib" , "/lib" ] ;
83
+
84
+ if ( Deno . build . os === "darwin" ) {
85
+ paths . push (
86
+ "/System/Library" ,
87
+ "/opt/homebrew/Frameworks" ,
88
+ "/usr/local/Frameworks" ,
89
+ ) ;
90
+
91
+ for ( const [ major , minor ] of versions ) {
92
+ const path = `Python.framework/Versions/${ major } .${ minor } /Python` ;
93
+ if ( await exists ( path ) ) {
94
+ paths . push ( path ) ;
95
+ }
96
+ }
97
+ }
98
+
99
+ for ( const path of paths ) {
83
100
for (
84
101
const location of await find ( path , `libpython*.${ extension } ` )
85
102
) {
@@ -89,15 +106,15 @@ async function findlibs(): Promise<string[]> {
89
106
}
90
107
91
108
for (
92
- const path of Deno . env . get (
109
+ const location of Deno . env . get (
93
110
Deno . build . os === "windows"
94
111
? "PATH"
95
112
: Deno . build . os === "darwin"
96
113
? "DYLD_LIBRARY_PATH"
97
114
: "LD_LIBRARY_PATH" ,
98
115
) ?. split ( Deno . build . os === "windows" ? ";" : ":" ) ?? [ ]
99
116
) {
100
- libs . concat ( await search ( path ) ) ;
117
+ libs . concat ( await search ( location ) ) ;
101
118
}
102
119
103
120
return [ ...new Set ( libs ) ] ;
@@ -113,7 +130,11 @@ export async function findlib(): Promise<string> {
113
130
const filename = `${ prefix } python${ version } .${ extension } ` ;
114
131
115
132
for ( const candidate of candidates ) {
116
- if ( candidate . endsWith ( filename ) ) {
133
+ if (
134
+ candidate . endsWith ( filename ) ||
135
+ ( Deno . build . os === "darwin" &&
136
+ candidate === `Python.framework/Versions/${ major } .${ minor } /Python` )
137
+ ) {
117
138
return candidate ;
118
139
}
119
140
}
0 commit comments