summaryrefslogtreecommitdiff
path: root/openbabel-3.1.1-bug2378.patch
diff options
context:
space:
mode:
authorCoprDistGit <infra@openeuler.org>2023-06-26 05:45:05 +0000
committerCoprDistGit <infra@openeuler.org>2023-06-26 05:45:05 +0000
commit591a21a311878e2daaefd471dfbdbec97b8b66e6 (patch)
treee8622fe82c9da0d6cc2a6c38e9951477f584a1c5 /openbabel-3.1.1-bug2378.patch
parentd7c45699b4b3e41973c9a1c0eadeb2cec369c50d (diff)
automatic import of openbabelopeneuler20.03
Diffstat (limited to 'openbabel-3.1.1-bug2378.patch')
-rw-r--r--openbabel-3.1.1-bug2378.patch44
1 files changed, 44 insertions, 0 deletions
diff --git a/openbabel-3.1.1-bug2378.patch b/openbabel-3.1.1-bug2378.patch
new file mode 100644
index 0000000..a0d5d8a
--- /dev/null
+++ b/openbabel-3.1.1-bug2378.patch
@@ -0,0 +1,44 @@
+From 4ba2fec17b786afebadfae800a015704ad533843 Mon Sep 17 00:00:00 2001
+From: dkoes <dkoes@pitt.edu>
+Date: Mon, 7 Jun 2021 11:04:25 -0400
+Subject: [PATCH] Resolve ImportError with make test
+
+This change will build _openbabel.so in scripts/python/openbabel instead
+of the default build/lib. This is necessary because openbabel.py tries
+to import _openbabel like this:
+
+if __package__ or "." in __name__:
+ from . import _openbabel
+else:
+ import _openbabel
+
+This results in a circular import error when running make test (the
+first branch of the if is triggered). This code appears to be generated by
+SWIG with no obvious way to change it to catch the ImportError and call
+import _openbabel instead. Note the PYTHONPATH is set to include
+build/lib, but it doesn't matter because SWIG is forcing the import to
+happen in scripts/python/openbabel.
+
+I'm not sure why this hasn't been a problem in the past, perhaps there's
+been a change in SWIG. This is with SWIG 4.0.1 and cmake 3.18.6.
+
+I think the best solution is to move all the files that are being built
+in /scripts to the build directory rather than polluting the src tree
+with them, but this would require changing all the bindings and I'm not
+up for building and testing every binding.
+---
+ scripts/CMakeLists.txt | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt
+index b715a546dd..56821641fe 100644
+--- a/scripts/CMakeLists.txt
++++ b/scripts/CMakeLists.txt
+@@ -106,6 +106,7 @@ if (DO_PYTHON_BINDINGS)
+ set_target_properties(bindings_python PROPERTIES
+ OUTPUT_NAME _openbabel
+ PREFIX ""
++ LIBRARY_OUTPUT_DIRECTORY "${openbabel_SOURCE_DIR}/scripts/python/openbabel/"
+ SUFFIX .so )
+ execute_process(
+ COMMAND