summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Greenan <kmg@box.com>2015-07-31 11:46:49 -0700
committerKevin Greenan <kmg@box.com>2015-07-31 11:46:49 -0700
commit553515d0c09392efdec86d29784d2e1e4f9ef67f (patch)
tree714f5cbdc9b3d89aaad4fcdef63dbf19824f8e78
parent4e2efcd952855f16e0c12d9c1b53838d974d1ce7 (diff)
downloadpyeclib-553515d0c09392efdec86d29784d2e1e4f9ef67f.tar.gz
A few fixes to the new setup.py library finder/installer.
-rw-r--r--setup.py31
1 files changed, 18 insertions, 13 deletions
diff --git a/setup.py b/setup.py
index 3aac98e..6c9ff44 100644
--- a/setup.py
+++ b/setup.py
@@ -29,6 +29,7 @@ import platform
import sys
from ctypes import *
+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
@@ -89,7 +90,7 @@ def _read_file_as_str(name):
return s
-def _liberasurecode_install_error():
+def _liberasurecode_install_error(library, library_url):
print("**********************************************")
print("** ")
print("*** Error: " + library + " build failed! ")
@@ -102,28 +103,33 @@ def _liberasurecode_install_error():
class build(_build):
def check_liberasure(self):
- library_basename = "erasurecode"
+ library_basename = "liberasurecode"
library_version = "1.0.8"
notfound = True
found_path = _find_library(library_basename)
+
+ if platform_str.find("Darwin") > -1:
+ liberasure_file = \
+ library_basename + "." + library_version + ".dylib"
+ else:
+ liberasure_file = \
+ library_basename + ".so." + library_version
+
if found_path:
if found_path.endswith(library_version) or \
found_path.find(library_version + ".") > -1:
# call 1.0.8 the only compatible version for now
notfound = False
- else:
+
+ if found_path and notfound:
# look harder
- if platform_str.find("Darwin") > -1:
- liberasure_file = \
- "lib" + library_basename + "." + library_version + ".dylib"
- else:
- liberasure_file = \
- "lib" + library_basename + ".so." + library_version
+ _build_default_lib_search_path()
for dir in (default_library_paths):
liberasure_file_path = dir + os.sep + liberasure_file
if (os.path.isfile(liberasure_file_path)):
notfound = False
break
+
if notfound:
print("***************************************************")
print("** ")
@@ -157,19 +163,18 @@ class build(_build):
print(configure_cmd)
retval = os.system(configure_cmd)
if retval != 0:
- _liberasurecode_install_error()
+ _liberasurecode_install_error(library, library_url)
os.chdir(curdir)
sys.exit(retval)
make_cmd = ("make && make install")
retval = os.system(make_cmd)
if retval != 0:
- _liberasurecode_install_error()
+ _liberasurecode_install_error(library, library_url)
os.chdir(curdir)
sys.exit(retval)
os.chdir(curdir)
else:
- _liberasurecode_install_error()
- os.chdir(curdir)
+ _liberasurecode_install_error(library, library_url)
sys.exit(-1)
def run(self):