summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Greenan <kmg@box.com>2015-08-02 09:40:30 -0700
committerKevin Greenan <kmg@box.com>2015-08-02 09:40:30 -0700
commit6bc5f26a6e361412df45f43e03cc32e65aed6e91 (patch)
tree3d6c338a30cc1cf4e17f9370294b1b58d023fd3f
parent1a9a3b18ff1274d417c3b365bb474daed5e27793 (diff)
downloadpyeclib-6bc5f26a6e361412df45f43e03cc32e65aed6e91.tar.gz
A few updates to deal with the Mac OS X weirdness with Xcode's linker bug.
To make things easier, we just detect the version of OS X and install into /usr/local instead of /usr. This is not perfect, but should be good enough.
-rw-r--r--setup.py20
1 files changed, 18 insertions, 2 deletions
diff --git a/setup.py b/setup.py
index ee51d1d..92c64cd 100644
--- a/setup.py
+++ b/setup.py
@@ -29,7 +29,7 @@ import platform
import sys
from ctypes import *
-from ctypes.util import _findLib_gcc
+from ctypes.util import *
from distutils.command.build import build as _build
from distutils.command.clean import clean as _clean
from distutils.sysconfig import EXEC_PREFIX as _exec_prefix
@@ -52,11 +52,27 @@ default_python_incdir = get_python_inc()
default_python_libdir = get_python_lib()
default_library_paths = [default_python_libdir]
+#
+# Prefix directory for ./configure
+#
+configure_prefix="/usr"
+if platform_str.find("Darwin") > -1:
+ #
+ # There appears to be a bug with OS 10.9 and later where
+ # specifying -L/usr/lib to the linker *will not* search
+ # /usr/lib, but will resolve to a directory in the Xcode
+ # tree.
+ #
+ mac_major = int(platform.mac_ver()[0].split(".")[0])
+ mac_minor = int(platform.mac_ver()[0].split(".")[1])
+ if mac_major == 10 and mac_minor > 9:
+ configure_prefix="/usr/local"
# utility routines
def _find_library(name):
target_lib = None
if os.name == 'posix' and sys.platform.startswith('linux'):
+ from ctypes.util import _findLib_gcc
target_lib = _findLib_gcc(name)
else:
target_lib = find_library(name)
@@ -156,7 +172,7 @@ class build(_build):
if (os.path.isdir(locallibsrcdir)):
curdir = os.getcwd()
os.chdir(locallibsrcdir)
- configure_cmd = ("./configure --prefix=/usr")
+ configure_cmd = ("./configure --prefix=%s" % configure_prefix)
if platform_arch[0].startswith('64'):
if os.path.exists('/usr/lib64'):
configure_cmd = configure_cmd + " --libdir=/usr/lib64"