Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/root-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,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
Expand Down
11 changes: 6 additions & 5 deletions bindings/pyroot/cppyy/CPyCppyy/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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()

Expand All @@ -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}/cppyy 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)

Expand Down
18 changes: 14 additions & 4 deletions bindings/pyroot/cppyy/cppyy/python/cppyy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
'include', # load and jit a header file
'c_include', # load and jit a C header file
'load_library', # load a shared library
'nullptr', # unique pointer representing NULL

Check failure on line 43 in bindings/pyroot/cppyy/cppyy/python/cppyy/__init__.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (F405)

bindings/pyroot/cppyy/cppyy/python/cppyy/__init__.py:43:5: F405 `nullptr` may be undefined, or defined from star imports
'sizeof', # size of a C++ type
'typeid', # typeid of a C++ type
'multi', # helper for multiple inheritance
Expand All @@ -64,27 +64,27 @@
ispypy = False

from . import _typemap
from ._version import __version__

Check failure on line 67 in bindings/pyroot/cppyy/cppyy/python/cppyy/__init__.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (F401)

bindings/pyroot/cppyy/cppyy/python/cppyy/__init__.py:67:23: F401 `._version.__version__` imported but unused; consider removing, adding to `__all__`, or using a redundant alias

# import separately instead of in the above try/except block for easier to
# understand tracebacks
if ispypy:
from ._pypy_cppyy import *

Check failure on line 72 in bindings/pyroot/cppyy/cppyy/python/cppyy/__init__.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (F403)

bindings/pyroot/cppyy/cppyy/python/cppyy/__init__.py:72:5: F403 `from ._pypy_cppyy import *` used; unable to detect undefined names
else:
from ._cpython_cppyy import *

Check failure on line 74 in bindings/pyroot/cppyy/cppyy/python/cppyy/__init__.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (F403)

bindings/pyroot/cppyy/cppyy/python/cppyy/__init__.py:74:5: F403 `from ._cpython_cppyy import *` used; unable to detect undefined names


#- allow importing from gbl --------------------------------------------------
sys.modules['cppyy.gbl'] = gbl

Check failure on line 78 in bindings/pyroot/cppyy/cppyy/python/cppyy/__init__.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (F405)

bindings/pyroot/cppyy/cppyy/python/cppyy/__init__.py:78:28: F405 `gbl` may be undefined, or defined from star imports
sys.modules['cppyy.gbl.std'] = gbl.std

Check failure on line 79 in bindings/pyroot/cppyy/cppyy/python/cppyy/__init__.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (F405)

bindings/pyroot/cppyy/cppyy/python/cppyy/__init__.py:79:32: F405 `gbl` may be undefined, or defined from star imports


#- external typemap ----------------------------------------------------------
_typemap.initialize(_backend) # also creates (u)int8_t mapper

Check failure on line 83 in bindings/pyroot/cppyy/cppyy/python/cppyy/__init__.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (F405)

bindings/pyroot/cppyy/cppyy/python/cppyy/__init__.py:83:21: F405 `_backend` may be undefined, or defined from star imports

try:
gbl.std.int8_t = gbl.int8_t # ensures same _integer_ type

Check failure on line 86 in bindings/pyroot/cppyy/cppyy/python/cppyy/__init__.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (F405)

bindings/pyroot/cppyy/cppyy/python/cppyy/__init__.py:86:23: F405 `gbl` may be undefined, or defined from star imports

Check failure on line 86 in bindings/pyroot/cppyy/cppyy/python/cppyy/__init__.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (F405)

bindings/pyroot/cppyy/cppyy/python/cppyy/__init__.py:86:5: F405 `gbl` may be undefined, or defined from star imports
gbl.std.uint8_t = gbl.uint8_t

Check failure on line 87 in bindings/pyroot/cppyy/cppyy/python/cppyy/__init__.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (F405)

bindings/pyroot/cppyy/cppyy/python/cppyy/__init__.py:87:5: F405 `gbl` may be undefined, or defined from star imports
except (AttributeError, TypeError):
pass

Expand Down Expand Up @@ -339,10 +339,20 @@

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
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
import glob
import platform

if platform.system() == "Windows":
# Install locations are handled differently on Windows
import libcppyy

ape = os.path.dirname(libcppyy.__file__)
else:
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
for i in range(3):
if os.path.exists(os.path.join(ape, 'include')):
break
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"""

import ctypes
import platform
import sys

from . import _stdcpp_fix
Expand All @@ -27,7 +28,11 @@
except ImportError:
c = None

import libcppyy as _backend
if platform.system() == "Windows":
# On Windows, the library has to be searched without prefix
import libcppyy as _backend
else:
import cppyy.libcppyy as _backend

if c is not None:
_backend._cpp_backend = c
Expand Down
6 changes: 2 additions & 4 deletions roottest/python/basic/PyROOT_datatypetest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"""
Expand Down Expand Up @@ -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"""

Expand Down
4 changes: 1 addition & 3 deletions roottest/python/basic/PyROOT_datatypetest_numpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"""
Expand Down
Loading