Skip to content

Commit b4acaef

Browse files
SwooshyCuebalanking
authored andcommitted
[#217] Remove Python 2 support code
1 parent 80fbcd7 commit b4acaef

4 files changed

Lines changed: 4 additions & 27 deletions

File tree

CMakeLists.txt

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,11 @@ if (NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE)
4646
message(STATUS "Setting unspecified CMAKE_BUILD_TYPE to '${CMAKE_BUILD_TYPE}'")
4747
endif()
4848

49-
if (NOT IRODS_PYTHON_VERSION)
50-
set(IRODS_PYTHON_VERSION "3" CACHE STRING "The version of python to link against" FORCE)
51-
message(STATUS "Setting unspecified IRODS_PYTHON_VERSION to '${IRODS_PYTHON_VERSION}'. This is the correct setting for normal builds.")
52-
endif()
53-
5449
find_package(OpenSSL REQUIRED COMPONENTS Crypto SSL)
5550
find_package(nlohmann_json "3.6.1" REQUIRED)
5651
find_package(fmt "8.1.1"
5752
HINTS "${IRODS_EXTERNALS_FULLPATH_FMT}")
58-
find_package(Python "${IRODS_PYTHON_VERSION}" REQUIRED COMPONENTS Development)
53+
find_package(Python 3 REQUIRED COMPONENTS Development)
5954

6055
set(
6156
PLUGIN

include/irods/private/re/python/irods_errors.hpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,8 @@
44
// include this first to fix macro redef warnings
55
#include <pyconfig.h>
66

7-
#include <patchlevel.h>
7+
#include <Python.h>
88

9-
#if PY_VERSION_HEX < 0x03000000
10-
extern "C" void initirods_errors();
11-
#else
12-
# include <Python.h>
139
extern "C" PyObject* PyInit_irods_errors();
14-
#endif
1510

1611
#endif // RE_PYTHON_IRODS_ERRORS_HPP

include/irods/private/re/python/irods_types.hpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,9 @@
3636

3737
#include "irods/private/re/python/types/type_sequence.hpp"
3838

39-
#if PY_VERSION_HEX < 0x03000000
40-
extern "C" void initirods_types();
41-
#else
42-
# include <Python.h>
39+
#include <Python.h>
40+
4341
extern "C" PyObject* PyInit_irods_types();
44-
#endif
4542

4643
void init_irods_types();
4744

src/main.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -193,11 +193,7 @@ namespace
193193
bp::handle<> h_encoded(PyUnicode_AsUTF8String(py_obj));
194194
void* storage = reinterpret_cast<boost::python::converter::rvalue_from_python_storage<std::string>*>(data)
195195
->storage.bytes;
196-
#if PY_VERSION_HEX < 0x03000000
197-
new (storage) std::string(PyString_AsString(h_encoded.get()));
198-
#else
199196
new (storage) std::string(PyBytes_AsString(h_encoded.get()));
200-
#endif
201197
data->convertible = storage;
202198
}
203199

@@ -343,15 +339,9 @@ namespace
343339
static irods::error start(irods::default_re_ctx&, const std::string& _instance_name)
344340
{
345341
try {
346-
#if PY_VERSION_HEX < 0x03000000
347-
PyImport_AppendInittab("plugin_wrappers", &initplugin_wrappers);
348-
PyImport_AppendInittab("irods_types", &initirods_types);
349-
PyImport_AppendInittab("irods_errors", &initirods_errors);
350-
#else
351342
PyImport_AppendInittab("plugin_wrappers", &PyInit_plugin_wrappers);
352343
PyImport_AppendInittab("irods_types", &PyInit_irods_types);
353344
PyImport_AppendInittab("irods_errors", &PyInit_irods_errors);
354-
#endif
355345
Py_InitializeEx(0);
356346
std::lock_guard<std::recursive_mutex> lock{python_mutex};
357347
boost::filesystem::path etc_irods_path = irods::get_irods_config_directory();

0 commit comments

Comments
 (0)