Skip to content

Commit 760027a

Browse files
committed
[PyROOT] Move CPython extensions into subdirectories
Closes #14917.
1 parent 21cccc6 commit 760027a

File tree

11 files changed

+31
-19
lines changed

11 files changed

+31
-19
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
@@ -150,6 +150,19 @@ set(libname ROOTPythonizations)
150150

151151
add_library(${libname} SHARED ${cpp_sources})
152152

153+
# To make sure that the library also ends up in the right subdirectory in the
154+
# build directory tree.
155+
if(MSVC)
156+
set_target_properties(${libname}
157+
PROPERTIES
158+
RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/bin/ROOT
159+
RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/bin/ROOT
160+
RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL ${CMAKE_BINARY_DIR}/bin/ROOT
161+
RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO ${CMAKE_BINARY_DIR}/bin/ROOT)
162+
else()
163+
set_target_properties(${libname} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib/ROOT)
164+
endif()
165+
153166
# Insert the ROOTPythonizationsPySources in the dependency graph
154167
add_dependencies(${libname} ROOTPythonizationsPySources)
155168

@@ -193,16 +206,16 @@ target_link_libraries(PyROOT INTERFACE cppyy_backend cppyy ROOTPythonizations)
193206

194207
# Install library
195208
install(TARGETS ${libname} EXPORT ${CMAKE_PROJECT_NAME}Exports
196-
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT libraries
197-
LIBRARY DESTINATION ${CMAKE_INSTALL_PYTHONDIR} COMPONENT libraries
198-
ARCHIVE DESTINATION ${CMAKE_INSTALL_PYTHONDIR} COMPONENT libraries)
209+
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}/ROOT COMPONENT libraries
210+
LIBRARY DESTINATION ${CMAKE_INSTALL_PYTHONDIR}/ROOT COMPONENT libraries
211+
ARCHIVE DESTINATION ${CMAKE_INSTALL_PYTHONDIR}/ROOT COMPONENT libraries)
199212

200213
# Install meta-target PyROOT3 (INTERFACE library)
201214
# Install library
202215
install(TARGETS PyROOT EXPORT ${CMAKE_PROJECT_NAME}Exports
203-
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT libraries
204-
LIBRARY DESTINATION ${CMAKE_INSTALL_PYTHONDIR} COMPONENT libraries
205-
ARCHIVE DESTINATION ${CMAKE_INSTALL_PYTHONDIR} COMPONENT libraries)
216+
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}/ROOT COMPONENT libraries
217+
LIBRARY DESTINATION ${CMAKE_INSTALL_PYTHONDIR}/ROOT COMPONENT libraries
218+
ARCHIVE DESTINATION ${CMAKE_INSTALL_PYTHONDIR}/ROOT COMPONENT libraries)
206219

207220
# Install Python sources and bytecode
208221
install(DIRECTORY ${localruntimedir}/ROOT

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

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

2525
import cppyy
2626
import sys, importlib
27-
import libROOTPythonizations
27+
import ROOT.libROOTPythonizations
2828

2929
# Build cache of commonly used python strings (the cache is python intern, so
3030
# all strings are shared python-wide, not just in PyROOT).
@@ -184,8 +184,8 @@ def cleanup():
184184
facade.__dict__["app"].keep_polling = False
185185
facade.__dict__["app"].process_root_events.join()
186186

187-
if "libROOTPythonizations" in sys.modules:
188-
backend = sys.modules["libROOTPythonizations"]
187+
if "ROOT.libROOTPythonizations" in sys.modules:
188+
backend = sys.modules["ROOT.libROOTPythonizations"]
189189

190190
# Make sure all the objects regulated by PyROOT are deleted and their
191191
# Python proxies are properly nonified.

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-2
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,9 @@
55
from functools import partial
66

77
import cppyy
8-
98
import cppyy.ll
109

11-
from libROOTPythonizations import gROOT
10+
from ROOT.libROOTPythonizations import gROOT
1211

1312
from ._application import PyROOTApplication
1413
from ._numbadeclare import _NumbaDeclareDecorator

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/_tmva/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
from .. import pythonization
1818

19-
from libROOTPythonizations import gROOT
19+
from ROOT.libROOTPythonizations import gROOT
2020

2121
from ._factory import Factory
2222
from ._dataloader import DataLoader

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
@@ -130,7 +130,7 @@
130130
*/
131131
"""
132132

133-
from libROOTPythonizations import GetBranchAttr, BranchPyz
133+
from ROOT.libROOTPythonizations import GetBranchAttr, BranchPyz
134134
from ._rvec import _array_interface_dtype_map, _get_cpp_type_from_numpy_type
135135
from . import pythonization
136136

0 commit comments

Comments
 (0)