Skip to content

Commit 87be7bb

Browse files
SwooshyCuebalanking
authored andcommitted
[#136] Remove no-longer-needed manual libpython loading
1 parent 6dcf157 commit 87be7bb

3 files changed

Lines changed: 1 addition & 61 deletions

File tree

CMakeLists.txt

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -43,37 +43,6 @@ find_package(OpenSSL REQUIRED COMPONENTS Crypto SSL)
4343
find_package(nlohmann_json "3.6.1" REQUIRED)
4444
find_package(Python "${IRODS_PYTHON_VERSION}" REQUIRED COMPONENTS Development)
4545

46-
get_target_property(__PYTHON_IMPORTED_LOCATION Python::Python IMPORTED_LOCATION)
47-
if (NOT IRODS_PYTHON_SONAME)
48-
get_target_property(IRODS_PYTHON_SONAME Python::Python IMPORTED_SONAME)
49-
if (NOT IRODS_PYTHON_SONAME)
50-
if (__PYTHON_IMPORTED_LOCATION)
51-
if (IS_SYMLINK "${__PYTHON_IMPORTED_LOCATION}")
52-
file(READ_SYMLINK "${__PYTHON_IMPORTED_LOCATION}" __PYTHON_LIBRARY_PATH)
53-
else()
54-
set(__PYTHON_LIBRARY_PATH "${__PYTHON_IMPORTED_LOCATION}")
55-
endif()
56-
get_filename_component(IRODS_PYTHON_SONAME "${__PYTHON_LIBRARY_PATH}" NAME)
57-
else()
58-
# We might be able to use python-config before falling back to guessing like this.
59-
if (Python_VERSION_MAJOR EQUAL "3" AND Python_VERSION_MINOR LESS "8")
60-
set(__PYTHON_VERSION_SUFFIX "m")
61-
else()
62-
set(__PYTHON_VERSION_SUFFIX "")
63-
endif()
64-
set(IRODS_PYTHON_SONAME "${CMAKE_SHARED_LIBRARY_PREFIX}python${Python_VERSION_MAJOR}.${Python_VERSION_MINOR}${__PYTHON_VERSION_SUFFIX}${CMAKE_SHARED_LIBRARY_SUFFIX}.1.0")
65-
endif()
66-
endif()
67-
message("Python SONAME detected as ${IRODS_PYTHON_SONAME}")
68-
endif()
69-
70-
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/include/irods/private/re/python")
71-
configure_file(
72-
"${CMAKE_CURRENT_SOURCE_DIR}/include/irods/private/re/python/config.hpp.in"
73-
"${CMAKE_CURRENT_BINARY_DIR}/include/irods/private/re/python/config.hpp"
74-
@ONLY
75-
)
76-
7746
set(
7847
PLUGIN
7948
irods_rule_engine_plugin-python
@@ -214,6 +183,7 @@ target_link_libraries(
214183
# libraries, and other libraries may be passed after libpython. To mitigate this, we toggle off
215184
# --as-needed just for Python::Python's IMPORTED_LOCATION. If we can't fetch IMPORTED_LOCATION, we
216185
# just toggle it for Python::Python.
186+
get_target_property(__PYTHON_IMPORTED_LOCATION Python::Python IMPORTED_LOCATION)
217187
if (__PYTHON_IMPORTED_LOCATION)
218188
target_link_libraries(
219189
${PLUGIN}

include/irods/private/re/python/config.hpp.in

Lines changed: 0 additions & 9 deletions
This file was deleted.

src/main.cpp

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
#include <irods/rsExecMyRule.hpp>
3838

3939
#include "irods/private/re/python.hpp"
40-
#include "irods/private/re/python/config.hpp"
4140

4241
#include <patchlevel.h>
4342
#pragma GCC diagnostic push
@@ -343,26 +342,6 @@ namespace
343342

344343
irods::error start(irods::default_re_ctx&, const std::string& _instance_name)
345344
{
346-
#ifdef IRODS_PYTHON_SONAME
347-
// Force python library to be loaded
348-
void* p = dlopen(IRODS_PYTHON_SONAME, RTLD_LAZY | RTLD_GLOBAL);
349-
350-
// clang-format off
351-
log_re::debug({
352-
{"rule_engine_plugin", rule_engine_name},
353-
{"dlopen_return_value", std::to_string(reinterpret_cast<std::uintptr_t>(p))},
354-
});
355-
// clang-format on
356-
if (!p) {
357-
// clang-format off
358-
log_re::debug({
359-
{"rule_engine_plugin", rule_engine_name},
360-
{"dlerror_return_value", dlerror()},
361-
});
362-
// clang-format on
363-
}
364-
#endif
365-
366345
try {
367346
#if PY_VERSION_HEX < 0x03000000
368347
PyImport_AppendInittab("plugin_wrappers", &initplugin_wrappers);

0 commit comments

Comments
 (0)