From ec3af9dd4d2b533b4b34257f871b0a3fa8ad6abb Mon Sep 17 00:00:00 2001 From: Stephan Hageboeck Date: Tue, 30 Sep 2025 17:33:52 +0200 Subject: [PATCH 1/5] [CI] Enable output-on-failure for post-install CI tests. --- .github/workflows/root-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/root-ci.yml b/.github/workflows/root-ci.yml index c7b7a82168116..65dc8b6c07488 100644 --- a/.github/workflows/root-ci.yml +++ b/.github/workflows/root-ci.yml @@ -606,7 +606,7 @@ jobs: - name: CTest in post-install test project working-directory: ${{ env.POST_INSTALL_DIR }} - run: ctest -j $(nproc) + run: ctest --output-on-failure -j $(nproc) event_file: # For any event that is not a PR, the CI will always run. In PRs, the CI From 3ea76794d039cfc04c5435fb855753d3cecafab5 Mon Sep 17 00:00:00 2001 From: Stephan Hageboeck Date: Wed, 1 Oct 2025 11:09:36 +0200 Subject: [PATCH 2/5] [NFC] Remove a stray whitespace. --- roottest/python/basic/PyROOT_datatypetest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roottest/python/basic/PyROOT_datatypetest.py b/roottest/python/basic/PyROOT_datatypetest.py index fc6da85cb4b25..85d8a488afe3f 100644 --- a/roottest/python/basic/PyROOT_datatypetest.py +++ b/roottest/python/basic/PyROOT_datatypetest.py @@ -580,7 +580,7 @@ def test09_global_builtin_types(self): raises(ValueError, setattr, gbl, 'g_uint', -1) raises(ValueError, setattr, gbl, 'g_ulong', -1) raises(ValueError, setattr, gbl, 'g_ulong64', -1) - + def test10_global_ptr(self): """Access of global objects through a pointer""" From d52d37c7363db9eac31875467312a551baefb446 Mon Sep 17 00:00:00 2001 From: Stephan Hageboeck Date: Wed, 1 Oct 2025 11:08:20 +0200 Subject: [PATCH 3/5] [cppyy] Minimise direct imports of libcppyy.so. This will facilitate moving it to a new location in the next commit. --- roottest/python/basic/PyROOT_datatypetest.py | 4 +--- roottest/python/basic/PyROOT_datatypetest_numpy.py | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/roottest/python/basic/PyROOT_datatypetest.py b/roottest/python/basic/PyROOT_datatypetest.py index 85d8a488afe3f..9e24ec0f54c58 100644 --- a/roottest/python/basic/PyROOT_datatypetest.py +++ b/roottest/python/basic/PyROOT_datatypetest.py @@ -37,9 +37,7 @@ def setup_class(cls): cls.datatypes = cppyy.load_reflection_info(cls.test_dct) cls.N = cppyy.gbl.N # In new Cppyy, nullptr can't be found in gbl. - # Take it from libcppyy (we could also use ROOT.nullptr) - import libcppyy - cls.nullptr = libcppyy.nullptr + cls.nullptr = cppyy._backend.nullptr def test01_load_reflection_cache(self): """Loading reflection info twice should result in the same object""" diff --git a/roottest/python/basic/PyROOT_datatypetest_numpy.py b/roottest/python/basic/PyROOT_datatypetest_numpy.py index 097dceeef7178..857814c7c8f13 100644 --- a/roottest/python/basic/PyROOT_datatypetest_numpy.py +++ b/roottest/python/basic/PyROOT_datatypetest_numpy.py @@ -37,9 +37,7 @@ def setup_class(cls): cls.datatypes = cppyy.load_reflection_info(cls.test_dct) cls.N = cppyy.gbl.N # In new Cppyy, nullptr can't be found in gbl. - # Take it from libcppyy (we could also use ROOT.nullptr) - import libcppyy - cls.nullptr = libcppyy.nullptr + cls.nullptr = cppyy._backend.nullptr def test01_buffer_to_numpy(self): """Wrap buffer with NumPy array""" From 6419d94f4a93da3542ace0b650200006ebe76171 Mon Sep 17 00:00:00 2001 From: Stephan Hageboeck Date: Tue, 30 Sep 2025 15:45:53 +0200 Subject: [PATCH 4/5] [cppyy] Move libcppyy.so to /cppyy/libcppyy.so When compiling ROOT in Gentoo, the following warning was issued: * Verifying compiled files for python3.13 * * QA Notice: The following unexpected files/directories were found * top-level in the site-packages directory: * * /usr/lib/python3.13/site-packages/libcppyy.so.6.37.01 * * This is most likely a bug in the build system. More information * can be found in the Python Guide: * https://projects.gentoo.org/python/guide/qawarn.html#stray-top-level-files-in-site-packages Similarly to #14917, this can be solved by moving it to /cppyy. Therefore: - Move the libray (except the .pyd dll). - Update the library's RUNPATHs for it to find ROOT libraries. Fix #20015. --- bindings/pyroot/cppyy/CPyCppyy/CMakeLists.txt | 11 ++++++----- bindings/pyroot/cppyy/cppyy/python/cppyy/__init__.py | 4 +++- .../pyroot/cppyy/cppyy/python/cppyy/_cpython_cppyy.py | 2 +- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/bindings/pyroot/cppyy/CPyCppyy/CMakeLists.txt b/bindings/pyroot/cppyy/CPyCppyy/CMakeLists.txt index 72fa06433eeed..13d4e5d83b36e 100644 --- a/bindings/pyroot/cppyy/CPyCppyy/CMakeLists.txt +++ b/bindings/pyroot/cppyy/CPyCppyy/CMakeLists.txt @@ -73,7 +73,8 @@ endif() add_library(cppyy SHARED src/CPyCppyyPyModule.cxx) # Set the suffix to '.so' and the prefix to 'lib' -set_target_properties(cppyy PROPERTIES ${ROOT_LIBRARY_PROPERTIES}) +set_target_properties(cppyy PROPERTIES ${ROOT_LIBRARY_PROPERTIES} + LIBRARY_OUTPUT_DIRECTORY ${localruntimedir}/cppyy) if(MSVC) target_link_libraries(cppyy PRIVATE CPyCppyy) set_target_properties(cppyy PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS TRUE) @@ -108,7 +109,7 @@ set_property(GLOBAL APPEND PROPERTY ROOT_EXPORTED_TARGETS cppyy) if(NOT MSVC) # Make sure that relative RUNPATH to main ROOT libraries is always correct. - ROOT_APPEND_LIBDIR_TO_INSTALL_RPATH(cppyy ${CMAKE_INSTALL_PYTHONDIR}) + ROOT_APPEND_LIBDIR_TO_INSTALL_RPATH(cppyy ${CMAKE_INSTALL_PYTHONDIR}/cppyy) ROOT_APPEND_LIBDIR_TO_INSTALL_RPATH(CPyCppyy ${CMAKE_INSTALL_LIBDIR}) endif() @@ -119,9 +120,9 @@ install(TARGETS CPyCppyy EXPORT ${CMAKE_PROJECT_NAME}Exports ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libraries) install(TARGETS cppyy EXPORT ${CMAKE_PROJECT_NAME}Exports - RUNTIME DESTINATION ${CMAKE_INSTALL_PYTHONDIR} COMPONENT libraries - LIBRARY DESTINATION ${CMAKE_INSTALL_PYTHONDIR} COMPONENT libraries - ARCHIVE DESTINATION ${CMAKE_INSTALL_PYTHONDIR} COMPONENT libraries) + RUNTIME DESTINATION ${CMAKE_INSTALL_PYTHONDIR} COMPONENT libraries # Windows + LIBRARY DESTINATION ${CMAKE_INSTALL_PYTHONDIR}/cppyy COMPONENT libraries + ARCHIVE DESTINATION ${CMAKE_INSTALL_PYTHONDIR}/cppyy COMPONENT libraries) file(COPY ${headers} DESTINATION ${CMAKE_BINARY_DIR}/include/CPyCppyy) diff --git a/bindings/pyroot/cppyy/cppyy/python/cppyy/__init__.py b/bindings/pyroot/cppyy/cppyy/python/cppyy/__init__.py index b04aeffca000e..7541c78d40f99 100644 --- a/bindings/pyroot/cppyy/cppyy/python/cppyy/__init__.py +++ b/bindings/pyroot/cppyy/cppyy/python/cppyy/__init__.py @@ -339,7 +339,9 @@ def add_library_path(path): apipath_extra = os.path.join(os.path.dirname(apipath), 'site', 'python'+ldversion) if not os.path.exists(os.path.join(apipath_extra, 'CPyCppyy')): - import glob, libcppyy + import glob + + import cppyy.libcppyy as libcppyy ape = os.path.dirname(libcppyy.__file__) # a "normal" structure finds the include directory up to 3 levels up, # ie. dropping lib/pythonx.y[md]/site-packages diff --git a/bindings/pyroot/cppyy/cppyy/python/cppyy/_cpython_cppyy.py b/bindings/pyroot/cppyy/cppyy/python/cppyy/_cpython_cppyy.py index f002931b0e717..42cfc379569a4 100644 --- a/bindings/pyroot/cppyy/cppyy/python/cppyy/_cpython_cppyy.py +++ b/bindings/pyroot/cppyy/cppyy/python/cppyy/_cpython_cppyy.py @@ -27,7 +27,7 @@ except ImportError: c = None -import libcppyy as _backend +import cppyy.libcppyy as _backend if c is not None: _backend._cpp_backend = c From b06b6e5c4e6356659c819070e08656f37d674b17 Mon Sep 17 00:00:00 2001 From: Stephan Hageboeck Date: Tue, 14 Oct 2025 10:40:04 +0200 Subject: [PATCH 5/5] [REMOVE] Debug library paths on Windows. --- .../pyroot/cppyy/cppyy/python/cppyy/__init__.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/bindings/pyroot/cppyy/cppyy/python/cppyy/__init__.py b/bindings/pyroot/cppyy/cppyy/python/cppyy/__init__.py index 7541c78d40f99..be40e91dc52f6 100644 --- a/bindings/pyroot/cppyy/cppyy/python/cppyy/__init__.py +++ b/bindings/pyroot/cppyy/cppyy/python/cppyy/__init__.py @@ -66,6 +66,19 @@ from . import _typemap from ._version import __version__ +# Help Windows locate cppyy/libcppyy, which should be in the same location as the current file: +if "win32" in sys.platform: + cppyy_path = os.path.dirname(__file__) + #result1 = os.add_dll_directory(cppyy_path) + #result2 = os.add_dll_directory(os.path.dirname(cppyy_path)) + print("___***** Exec path:", os.get_exec_path()) + #print(result1, result2) + for path in [cppyy_path, os.path.join(cppyy_path, 'cppyy'), os.path.dirname(cppyy_path), os.path.dirname(os.path.dirname(cppyy_path)), '.']: + try: + print("___****** Listing", path, os.listdir(path)) + except FileNotFoundError: + print("___****** Not found:", path) + # import separately instead of in the above try/except block for easier to # understand tracebacks if ispypy: