diff --git a/.github/workflows/root-ci.yml b/.github/workflows/root-ci.yml index af708beb91aa8..b5d57741c12ca 100644 --- a/.github/workflows/root-ci.yml +++ b/.github/workflows/root-ci.yml @@ -601,7 +601,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 diff --git a/bindings/pyroot/cppyy/CPyCppyy/CMakeLists.txt b/bindings/pyroot/cppyy/CPyCppyy/CMakeLists.txt index 98a93a5c24c0f..28e6e993fd723 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) @@ -116,7 +117,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() @@ -127,9 +128,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}/cppyy COMPONENT libraries + 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..bab7a61f66372 100644 --- a/bindings/pyroot/cppyy/cppyy/python/cppyy/__init__.py +++ b/bindings/pyroot/cppyy/cppyy/python/cppyy/__init__.py @@ -66,6 +66,12 @@ 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__) + os.add_dll_directory(cppyy_path) + os.add_dll_directory(os.path.dirname(cppyy_path)) + # import separately instead of in the above try/except block for easier to # understand tracebacks if ispypy: @@ -339,7 +345,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 diff --git a/roottest/python/basic/PyROOT_datatypetest.py b/roottest/python/basic/PyROOT_datatypetest.py index fc6da85cb4b25..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""" @@ -580,7 +578,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""" 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"""