diff options
-rw-r--r-- | sources/shiboken6/generator/shiboken/cppgenerator.cpp | 8 | ||||
-rw-r--r-- | sources/shiboken6/shibokenmodule/CMakeLists.txt | 24 |
2 files changed, 32 insertions, 0 deletions
diff --git a/sources/shiboken6/generator/shiboken/cppgenerator.cpp b/sources/shiboken6/generator/shiboken/cppgenerator.cpp index 40f98b642..51ac49c9d 100644 --- a/sources/shiboken6/generator/shiboken/cppgenerator.cpp +++ b/sources/shiboken6/generator/shiboken/cppgenerator.cpp @@ -6246,6 +6246,14 @@ bool CppGenerator::finishGeneration() << "_SignatureStrings);\n" << "\nreturn module;\n" << outdent << "}\n"; + // Temporary hack to allow that the same module can be used both as + // `Shiboken` and `shiboken6`; this will go away in 6.1. + if (moduleName() == QLatin1String("Shiboken")) { + s << "\n// This function should be removed in version 6.2.\n" + << "extern \"C\" LIBSHIBOKEN_EXPORT PyObject *PyInit_shiboken6()\n{\n" << indent + << "return PyInit_Shiboken();\n" << outdent + << "}\n"; + } return file.done() != FileOut::Failure; } diff --git a/sources/shiboken6/shibokenmodule/CMakeLists.txt b/sources/shiboken6/shibokenmodule/CMakeLists.txt index eb8412462..e6944e942 100644 --- a/sources/shiboken6/shibokenmodule/CMakeLists.txt +++ b/sources/shiboken6/shibokenmodule/CMakeLists.txt @@ -82,3 +82,27 @@ configure_file("${shiboken_version_path}" install(FILES "${CMAKE_CURRENT_BINARY_DIR}/_git_shiboken_module_version.py" DESTINATION "${PYTHON_SITE_PACKAGES}/shiboken6") + +# Temporary copy of `Shiboken` to `shiboken6` until PySide 6.2 +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/copy_renamed_binary.py" "if True: + import os, sys + from shutil import copyfile + fpath = sys.argv[-1] + fname = os.path.basename(fpath).replace('Shiboken', 'shiboken6') + # copying to `install` + instdir = os.path.join('${PYTHON_SITE_PACKAGES}', 'shiboken6') + os.makedirs(instdir, exist_ok=True) + newname = os.path.join(instdir, fname) + copyfile(fpath, newname) + # copying to `build` + builddir = '${CMAKE_CURRENT_BINARY_DIR}' + newname = os.path.join(builddir, '..', fname) + copyfile(fpath, newname) + ") + +add_custom_command(TARGET shibokenmodule POST_BUILD + COMMAND ${PYTHON_EXECUTABLE} + "${CMAKE_CURRENT_BINARY_DIR}/copy_renamed_binary.py" + "$<TARGET_FILE:shibokenmodule>" + COMMENT "running Python postprocess" + ) |