pythonPackages.cx_oracle: fix dlopen

previously, $ORACLE_HOME had to be set for each python script using this
library.

We now patch odpi to load libclntsh.so from oracle-instantclient if
$ORACLE_HOME was not provided.
This commit is contained in:
Florian Klink 2018-05-17 18:43:25 +02:00
parent a88354d99f
commit 639f7952be
2 changed files with 33 additions and 0 deletions

View File

@ -0,0 +1,27 @@
From 355b9d812efdfbd041e14b365258b69c81689981 Mon Sep 17 00:00:00 2001
From: Florian Klink <flokli@flokli.de>
Date: Thu, 17 May 2018 18:37:40 +0200
Subject: [PATCH] odpi/src/dpiOci.c: nixify libclntsh.so dlopen
---
odpi/src/dpiOci.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/odpi/src/dpiOci.c b/odpi/src/dpiOci.c
index 76b9867..22c2987 100644
--- a/odpi/src/dpiOci.c
+++ b/odpi/src/dpiOci.c
@@ -1575,6 +1575,10 @@ static int dpiOci__loadLib(dpiError *error)
}
}
}
+ if(!dpiOciLibHandle) {
+ dpiOciLibHandle = dlopen("@libclntsh@", RTLD_LAZY);
+ }
+
#endif
if (!dpiOciLibHandle) {
--
2.16.3

View File

@ -13,6 +13,12 @@ buildPythonPackage rec {
sha256 = "0200j6jh80rpgzxmvgcxmkshaj4zadq32g2i97nlwiq3f7q374l7";
};
patches = [ ./0001-odpi-src-dpiOci.c-nixify-libclntsh.so-dlopen.patch ];
postPatch = ''
substituteInPlace odpi/src/dpiOci.c --replace @libclntsh@ ${oracle-instantclient}/lib/libclntsh.so";
'';
# Check need an Oracle database to run
doCheck = false;