Skip to content

Commit cae535e

Browse files
committed
[PyROOT] Move CPython extensions into subdirectories
Closes #14917.
1 parent 8435a18 commit cae535e

File tree

10 files changed

+27
-15
lines changed

10 files changed

+27
-15
lines changed

bindings/jupyroot/python/JupyROOT/helpers/handlers.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
import queue
2020

2121
from JupyROOT import helpers
22-
import libROOTPythonizations as _lib
22+
import ROOT.libROOTPythonizations as _lib
2323

2424

2525
class IOHandler(object):

bindings/pyroot/pythonizations/CMakeLists.txt

+19-6
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,19 @@ set(libname ROOTPythonizations)
172172

173173
add_library(${libname} SHARED ${cpp_sources})
174174

175+
# To make sure that the library also ends up in the right subdirectory in the
176+
# build directory tree.
177+
if(MSVC)
178+
set_target_properties(${libname}
179+
PROPERTIES
180+
RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/bin/ROOT
181+
RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/bin/ROOT
182+
RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL ${CMAKE_BINARY_DIR}/bin/ROOT
183+
RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO ${CMAKE_BINARY_DIR}/bin/ROOT)
184+
else()
185+
set_target_properties(${libname} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib/ROOT)
186+
endif()
187+
175188
# Insert the ROOTPythonizationsPySources in the dependency graph
176189
add_dependencies(${libname} ROOTPythonizationsPySources)
177190

@@ -215,16 +228,16 @@ target_link_libraries(PyROOT INTERFACE cppyy_backend cppyy ROOTPythonizations)
215228

216229
# Install library
217230
install(TARGETS ${libname} EXPORT ${CMAKE_PROJECT_NAME}Exports
218-
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT libraries
219-
LIBRARY DESTINATION ${CMAKE_INSTALL_PYTHONDIR} COMPONENT libraries
220-
ARCHIVE DESTINATION ${CMAKE_INSTALL_PYTHONDIR} COMPONENT libraries)
231+
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}/ROOT COMPONENT libraries
232+
LIBRARY DESTINATION ${CMAKE_INSTALL_PYTHONDIR}/ROOT COMPONENT libraries
233+
ARCHIVE DESTINATION ${CMAKE_INSTALL_PYTHONDIR}/ROOT COMPONENT libraries)
221234

222235
# Install meta-target PyROOT3 (INTERFACE library)
223236
# Install library
224237
install(TARGETS PyROOT EXPORT ${CMAKE_PROJECT_NAME}Exports
225-
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT libraries
226-
LIBRARY DESTINATION ${CMAKE_INSTALL_PYTHONDIR} COMPONENT libraries
227-
ARCHIVE DESTINATION ${CMAKE_INSTALL_PYTHONDIR} COMPONENT libraries)
238+
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}/ROOT COMPONENT libraries
239+
LIBRARY DESTINATION ${CMAKE_INSTALL_PYTHONDIR}/ROOT COMPONENT libraries
240+
ARCHIVE DESTINATION ${CMAKE_INSTALL_PYTHONDIR}/ROOT COMPONENT libraries)
228241

229242
# Install Python sources and bytecode
230243
install(DIRECTORY ${localruntimedir}/ROOT

bindings/pyroot/pythonizations/python/ROOT/__init__.py

-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424

2525
import cppyy
2626
import sys, importlib
27-
import libROOTPythonizations
2827

2928
# Build cache of commonly used python strings (the cache is python intern, so
3029
# all strings are shared python-wide, not just in PyROOT).

bindings/pyroot/pythonizations/python/ROOT/_application.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
from cppyy.gbl import gSystem, gInterpreter, gEnv
1515

16-
from libROOTPythonizations import InitApplication, InstallGUIEventInputHook
16+
from ROOT.libROOTPythonizations import InitApplication, InstallGUIEventInputHook
1717

1818

1919
class PyROOTApplication(object):

bindings/pyroot/pythonizations/python/ROOT/_facade.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ def _register_converters_and_executors(self):
175175
"Double32_t&": "double&",
176176
}
177177

178-
from libROOTPythonizations import CPyCppyyRegisterConverterAlias, CPyCppyyRegisterExecutorAlias
178+
from ROOT.libROOTPythonizations import CPyCppyyRegisterConverterAlias, CPyCppyyRegisterExecutorAlias
179179

180180
for name, target in converter_aliases.items():
181181
CPyCppyyRegisterConverterAlias(name, target)

bindings/pyroot/pythonizations/python/ROOT/_pythonization/_cppinstance.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
def pythonize_cppinstance():
1212
import cppyy
13-
from libROOTPythonizations import AddCPPInstancePickling
13+
from ROOT.libROOTPythonizations import AddCPPInstancePickling
1414

1515
klass = cppyy._backend.CPPInstance
1616

bindings/pyroot/pythonizations/python/ROOT/_pythonization/_generic.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
# For the list of contributors see $ROOTSYS/README/CREDITS. #
99
################################################################################
1010

11-
from libROOTPythonizations import AddPrettyPrintingPyz
11+
from ROOT.libROOTPythonizations import AddPrettyPrintingPyz
1212

1313
def _add_getitem_checked(klass):
1414
# Parameters:

bindings/pyroot/pythonizations/python/ROOT/_pythonization/_tclass.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
################################################################################
1010

1111
import cppyy
12-
from libROOTPythonizations import AddTClassDynamicCastPyz
12+
from ROOT.libROOTPythonizations import AddTClassDynamicCastPyz
1313

1414

1515
def pythonize_tclass():

bindings/pyroot/pythonizations/python/ROOT/_pythonization/_tobject.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
# For the list of contributors see $ROOTSYS/README/CREDITS. #
99
################################################################################
1010

11-
from libROOTPythonizations import AddTObjectEqNePyz
11+
from ROOT.libROOTPythonizations import AddTObjectEqNePyz
1212
import cppyy
1313

1414
# Searching

bindings/pyroot/pythonizations/python/ROOT/_pythonization/_ttree.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@
159159
\endpythondoc
160160
"""
161161

162-
from libROOTPythonizations import GetBranchAttr, BranchPyz
162+
from ROOT.libROOTPythonizations import GetBranchAttr, BranchPyz
163163
from ._rvec import _array_interface_dtype_map, _get_cpp_type_from_numpy_type
164164
from . import pythonization
165165
from ROOT._pythonization._memory_utils import _should_give_up_ownership, _constructor_releasing_ownership, _SetDirectory_SetOwnership

0 commit comments

Comments
 (0)