Add support for searching lib32 or lib64 depending on whether the host is
32-bit or 64-bit. Thanks to Joe Shaw for the patch.
This commit is contained in:
parent
c18c0148f3
commit
e6484f98a2
56
setup.py
56
setup.py
|
@ -62,21 +62,24 @@ docFiles = "LICENSE.txt README.txt BUILD.txt HISTORY.txt html samples test"
|
||||||
def CheckOracleHome(directoryToCheck):
|
def CheckOracleHome(directoryToCheck):
|
||||||
global oracleHome, oracleVersion, oracleLibDir
|
global oracleHome, oracleVersion, oracleLibDir
|
||||||
if sys.platform in ("win32", "cygwin"):
|
if sys.platform in ("win32", "cygwin"):
|
||||||
subDir = "bin"
|
subDirs = ["bin"]
|
||||||
filesToCheck = [
|
filesToCheck = [
|
||||||
("11g", "oraocci11.dll"),
|
("11g", "oraocci11.dll"),
|
||||||
("10g", "oraocci10.dll"),
|
("10g", "oraocci10.dll"),
|
||||||
("9i", "oraclient9.dll")
|
("9i", "oraclient9.dll")
|
||||||
]
|
]
|
||||||
elif sys.platform == "darwin":
|
elif sys.platform == "darwin":
|
||||||
subDir = "lib"
|
subDirs = ["lib"]
|
||||||
filesToCheck = [
|
filesToCheck = [
|
||||||
("11g", "libclntsh.dylib.11.1"),
|
("11g", "libclntsh.dylib.11.1"),
|
||||||
("10g", "libclntsh.dylib.10.1"),
|
("10g", "libclntsh.dylib.10.1"),
|
||||||
("9i", "libclntsh.dylib.9.0")
|
("9i", "libclntsh.dylib.9.0")
|
||||||
]
|
]
|
||||||
else:
|
else:
|
||||||
subDir = "lib"
|
if struct.calcsize("P") == 4:
|
||||||
|
subDirs = ["lib", "lib32"]
|
||||||
|
else:
|
||||||
|
subDirs = ["lib", "lib64"]
|
||||||
filesToCheck = [
|
filesToCheck = [
|
||||||
("11g", "libclntsh.so.11.1"),
|
("11g", "libclntsh.so.11.1"),
|
||||||
("10g", "libclntsh.so.10.1"),
|
("10g", "libclntsh.so.10.1"),
|
||||||
|
@ -92,19 +95,20 @@ def CheckOracleHome(directoryToCheck):
|
||||||
oracleLibDir = directoryToCheck
|
oracleLibDir = directoryToCheck
|
||||||
oracleVersion = version
|
oracleVersion = version
|
||||||
return True
|
return True
|
||||||
fileName = os.path.join(directoryToCheck, subDir, baseFileName)
|
for subDir in subDirs:
|
||||||
if os.path.exists(fileName):
|
fileName = os.path.join(directoryToCheck, subDir, baseFileName)
|
||||||
oracleHome = directoryToCheck
|
if os.path.exists(fileName):
|
||||||
oracleLibDir = os.path.join(directoryToCheck, subDir)
|
oracleHome = directoryToCheck
|
||||||
oracleVersion = version
|
oracleLibDir = os.path.join(directoryToCheck, subDir)
|
||||||
return True
|
oracleVersion = version
|
||||||
dirName = os.path.dirname(directoryToCheck)
|
return True
|
||||||
fileName = os.path.join(dirName, subDir, baseFileName)
|
dirName = os.path.dirname(directoryToCheck)
|
||||||
if os.path.exists(fileName):
|
fileName = os.path.join(dirName, subDir, baseFileName)
|
||||||
oracleHome = dirName
|
if os.path.exists(fileName):
|
||||||
oracleLibDir = os.path.join(dirName, subDir)
|
oracleHome = dirName
|
||||||
oracleVersion = version
|
oracleLibDir = os.path.join(dirName, subDir)
|
||||||
return True
|
oracleVersion = version
|
||||||
|
return True
|
||||||
oracleHome = oracleVersion = oracleLibDir = None
|
oracleHome = oracleVersion = oracleLibDir = None
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
@ -147,6 +151,15 @@ elif sys.platform == "cygwin":
|
||||||
libDirs[i] = os.path.join(oracleHome, libDirs[i])
|
libDirs[i] = os.path.join(oracleHome, libDirs[i])
|
||||||
libs = ["oci"]
|
libs = ["oci"]
|
||||||
else:
|
else:
|
||||||
|
libPath = os.path.join(oracleHome, "lib")
|
||||||
|
if struct.calcsize("P") == 4:
|
||||||
|
alternatePath = os.path.join(oracleHome, "lib32")
|
||||||
|
else:
|
||||||
|
alternatePath = os.path.join(oracleHome, "lib64")
|
||||||
|
if os.path.exists(alternatePath):
|
||||||
|
libPath = alternatePath
|
||||||
|
libDirs = [libPath, oracleHome]
|
||||||
|
libs = ["clntsh"]
|
||||||
possibleIncludeDirs = ["rdbms/demo", "rdbms/public", "network/public",
|
possibleIncludeDirs = ["rdbms/demo", "rdbms/public", "network/public",
|
||||||
"sdk/include"]
|
"sdk/include"]
|
||||||
if sys.platform == "darwin":
|
if sys.platform == "darwin":
|
||||||
|
@ -157,20 +170,11 @@ else:
|
||||||
if os.path.isdir(path):
|
if os.path.isdir(path):
|
||||||
includeDirs.append(path)
|
includeDirs.append(path)
|
||||||
if not includeDirs:
|
if not includeDirs:
|
||||||
path = oracleHome.replace("lib", "include")
|
path = os.path.join(os.path.dirname(libPath), "include")
|
||||||
if os.path.isdir(path):
|
if os.path.isdir(path):
|
||||||
includeDirs.append(path)
|
includeDirs.append(path)
|
||||||
if not includeDirs:
|
if not includeDirs:
|
||||||
raise DistutilsSetupError("cannot locate Oracle include files")
|
raise DistutilsSetupError("cannot locate Oracle include files")
|
||||||
libPath = os.path.join(oracleHome, "lib")
|
|
||||||
if struct.calcsize("P") == 4:
|
|
||||||
alternatePath = os.path.join(oracleHome, "lib32")
|
|
||||||
else:
|
|
||||||
alternatePath = os.path.join(oracleHome, "lib64")
|
|
||||||
if os.path.exists(alternatePath):
|
|
||||||
libPath = alternatePath
|
|
||||||
libDirs = [libPath, oracleHome]
|
|
||||||
libs = ["clntsh"]
|
|
||||||
|
|
||||||
# NOTE: on HP-UX Itanium with Oracle 10g you need to add the library "ttsh10"
|
# NOTE: on HP-UX Itanium with Oracle 10g you need to add the library "ttsh10"
|
||||||
# to the list of libraries along with "clntsh"; since I am unable to test, I'll
|
# to the list of libraries along with "clntsh"; since I am unable to test, I'll
|
||||||
|
|
Loading…
Reference in New Issue