Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 30be9c9

Browse files
fractusvmuriart
authored andcommitted
Added branching for ldd command in OSX (#406)
1 parent db6c1b2 commit 30be9c9

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

setup.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -162,16 +162,15 @@ def build_extension(self, ext):
162162
defines.extend(["DEBUG", "TRACE"])
163163

164164
if sys.platform != "win32" and DEVTOOLS == "Mono":
165-
if sys.platform == "darwin":
166-
defines.append("MONO_OSX")
167-
else:
168-
defines.append("MONO_LINUX")
165+
on_darwin = sys.platform == "darwin"
166+
defines.append("MONO_OSX" if on_darwin else "MONO_LINUX")
169167

170168
# Check if --enable-shared was set when Python was built
171169
enable_shared = sysconfig.get_config_var("Py_ENABLE_SHARED")
172170
if enable_shared:
173171
# Double-check if libpython is linked dynamically with python
174-
lddout = _check_output(["ldd", sys.executable])
172+
ldd_cmd = ["otool", "-L"] if on_darwin else ["ldd"]
173+
lddout = _check_output(ldd_cmd + [sys.executable])
175174
if 'libpython' not in lddout:
176175
enable_shared = False
177176

0 commit comments

Comments
 (0)