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

Skip to content

Commit 66d755f

Browse files
author
denfromufa
authored
Work around a broken shared detection on some platforms (#300)
* Update setup.py #119 * Update setup.py * Update setup.py * Update setup.py * Update .travis.yml no more python 2.6 - missing subprocess.check_output() * Small cleanup.
1 parent 4361da2 commit 66d755f

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

.travis.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
sudo: required
22
language: python
33
python:
4-
- 2.6
54
- 2.7
65
- 3.2
76
- 3.4

setup.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from distutils.spawn import find_executable
1111
from distutils import log
1212
from platform import architecture
13-
from subprocess import Popen, CalledProcessError, PIPE, check_call
13+
from subprocess import Popen, CalledProcessError, PIPE, check_call, check_output
1414
from glob import glob
1515
import fnmatch
1616
import sys
@@ -153,7 +153,13 @@ def build_extension(self, ext):
153153

154154
# Check if --enable-shared was set when Python was built
155155
enable_shared = get_config_var("Py_ENABLE_SHARED")
156-
if enable_shared == 0:
156+
if enable_shared:
157+
# Double-check if libpython is linked dynamically with python
158+
lddout = check_output(["ldd", sys.executable])
159+
if b'libpython' not in lddout:
160+
enable_shared = False
161+
162+
if not enable_shared:
157163
defines.append("PYTHON_WITHOUT_ENABLE_SHARED")
158164

159165
if hasattr(sys, "abiflags"):

0 commit comments

Comments
 (0)