Skip to content

Commit 9e24937

Browse files
committed
[PyROOT] Move CPython extensions into subdirectories
Closes #14917.
1 parent db8f2ef commit 9e24937

File tree

11 files changed

+26
-18
lines changed

11 files changed

+26
-18
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

+14-6
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,14 @@ set(libname ROOTPythonizations)
144144

145145
add_library(${libname} SHARED ${cpp_sources})
146146

147+
# To make sure that the library also ends up in the right subdirectory in the
148+
# build directory tree.
149+
if(MSVC)
150+
set_target_properties(${libname} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/ROOT)
151+
else()
152+
set_target_properties(${libname} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib/ROOT)
153+
endif()
154+
147155
# Insert the ROOTPythonizationsPySources in the dependency graph
148156
add_dependencies(${libname} ROOTPythonizationsPySources)
149157

@@ -187,16 +195,16 @@ target_link_libraries(PyROOT INTERFACE cppyy_backend cppyy ROOTPythonizations)
187195

188196
# Install library
189197
install(TARGETS ${libname} EXPORT ${CMAKE_PROJECT_NAME}Exports
190-
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT libraries
191-
LIBRARY DESTINATION ${CMAKE_INSTALL_PYTHONDIR} COMPONENT libraries
192-
ARCHIVE DESTINATION ${CMAKE_INSTALL_PYTHONDIR} COMPONENT libraries)
198+
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}/ROOT COMPONENT libraries
199+
LIBRARY DESTINATION ${CMAKE_INSTALL_PYTHONDIR}/ROOT COMPONENT libraries
200+
ARCHIVE DESTINATION ${CMAKE_INSTALL_PYTHONDIR}/ROOT COMPONENT libraries)
193201

194202
# Install meta-target PyROOT3 (INTERFACE library)
195203
# Install library
196204
install(TARGETS PyROOT EXPORT ${CMAKE_PROJECT_NAME}Exports
197-
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT libraries
198-
LIBRARY DESTINATION ${CMAKE_INSTALL_PYTHONDIR} COMPONENT libraries
199-
ARCHIVE DESTINATION ${CMAKE_INSTALL_PYTHONDIR} COMPONENT libraries)
205+
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}/ROOT COMPONENT libraries
206+
LIBRARY DESTINATION ${CMAKE_INSTALL_PYTHONDIR}/ROOT COMPONENT libraries
207+
ARCHIVE DESTINATION ${CMAKE_INSTALL_PYTHONDIR}/ROOT COMPONENT libraries)
200208

201209
# Install Python sources and bytecode
202210
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-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import libcppyy as cppyy_backend
88
from cppyy import gbl as gbl_namespace
99
from cppyy import cppdef, include
10-
from libROOTPythonizations import gROOT
10+
from ROOT.libROOTPythonizations import gROOT
1111
from cppyy.gbl import gSystem
1212
import cppyy.ll
1313

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

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

1111
import libcppyy
12-
from libROOTPythonizations import AddCPPInstancePickling
12+
from ROOT.libROOTPythonizations import AddCPPInstancePickling
1313

1414
def pythonize_cppinstance():
1515
klass = libcppyy.CPPInstance

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 AddBranchAttrSyntax, SetBranchAddressPyz, BranchPyz
133+
from ROOT.libROOTPythonizations import AddBranchAttrSyntax, SetBranchAddressPyz, BranchPyz
134134
from . import pythonization
135135

136136
# TTree iterator

0 commit comments

Comments
 (0)