3636BUILD_DIR = tempfile .mkdtemp ()
3737INSTALL_DIR = tempfile .mkdtemp ()
3838
39+ # Name given to an internal directory within the build directory
40+ # used to mimick the structure of the target installation directory
41+ # in the user Python environment, usually named "site-packages"
42+ ROOT_BUILD_INTERNAL_DIRNAME = "mock_site_packages"
43+
3944
4045class ROOTBuild (_build ):
4146 def run (self ):
@@ -50,6 +55,12 @@ def run(self):
5055 "-Dbuiltin_lz4=ON -Dbuiltin_lzma=ON -Dbuiltin_zstd=ON -Dbuiltin_xxhash=ON " # builtins
5156 "-Dpyroot=ON -Ddataframe=ON -Dxrootd=ON -Dssl=ON -Dimt=ON "
5257 "-Droofit=ON "
58+ # Next 4 paths represent the structure of the target binaries/headers/libs
59+ # as the target installation directory of the Python environment would expect
60+ f"-DCMAKE_INSTALL_BINDIR={ ROOT_BUILD_INTERNAL_DIRNAME } /ROOT/bin "
61+ f"-DCMAKE_INSTALL_INCLUDEDIR={ ROOT_BUILD_INTERNAL_DIRNAME } /ROOT/include "
62+ f"-DCMAKE_INSTALL_LIBDIR={ ROOT_BUILD_INTERNAL_DIRNAME } /ROOT/lib "
63+ f"-DCMAKE_INSTALL_PYTHONDIR={ ROOT_BUILD_INTERNAL_DIRNAME } "
5364 f"-DCMAKE_INSTALL_PREFIX={ INSTALL_DIR } -B { BUILD_DIR } -S { SOURCE_DIR } "
5465 )
5566 subprocess .run (configure_command , check = True )
@@ -79,16 +90,22 @@ def run(self):
7990 lib_dir = os .path .join (INSTALL_DIR , "lib" )
8091
8192 # Copy ROOT installation tree to the ROOT package directory in the pip installation path
82- self .copy_tree (INSTALL_DIR , os .path .join (install_path , "ROOT" ))
83-
84- # Copy cppyy packages separately
85- self .copy_tree (os .path .join (lib_dir , "cppyy" ), os .path .join (install_path , "cppyy" ))
86- self .copy_tree (os .path .join (lib_dir , "cppyy_backend" ), os .path .join (install_path , "cppyy_backend" ))
87-
88- # Finally copy CPython extension libraries
89- self .copy_file (os .path .join (lib_dir , "libcppyy.so" ), install_path )
90- self .copy_file (os .path .join (lib_dir , "libcppyy_backend.so" ), install_path )
91- self .copy_file (os .path .join (lib_dir , "ROOT" , "libROOTPythonizations.so" ), os .path .join (install_path , "ROOT" ))
93+ self .copy_tree (os .path .join (INSTALL_DIR , ROOT_BUILD_INTERNAL_DIRNAME ), install_path )
94+
95+ root_package_dir = os .path .join (install_path , "ROOT" )
96+
97+ # After the copy of the "mock" package structure from the ROOT installations, these are the
98+ # leftover directories that still need to be copied
99+ self .copy_tree (os .path .join (INSTALL_DIR , "cmake" ), os .path .join (root_package_dir , "cmake" ))
100+ self .copy_tree (os .path .join (INSTALL_DIR , "config" ), os .path .join (root_package_dir , "config" ))
101+ self .copy_tree (os .path .join (INSTALL_DIR , "etc" ), os .path .join (root_package_dir , "etc" ))
102+ self .copy_tree (os .path .join (INSTALL_DIR , "fonts" ), os .path .join (root_package_dir , "fonts" ))
103+ self .copy_tree (os .path .join (INSTALL_DIR , "icons" ), os .path .join (root_package_dir , "icons" ))
104+ self .copy_tree (os .path .join (INSTALL_DIR , "macros" ), os .path .join (root_package_dir , "macros" ))
105+ self .copy_tree (os .path .join (INSTALL_DIR , "man" ), os .path .join (root_package_dir , "man" ))
106+ self .copy_tree (os .path .join (INSTALL_DIR , "README" ), os .path .join (root_package_dir , "README" ))
107+ self .copy_tree (os .path .join (INSTALL_DIR , "tutorials" ), os .path .join (root_package_dir , "tutorials" ))
108+ self .copy_file (os .path .join (INSTALL_DIR , "LICENSE" ), os .path .join (root_package_dir , "LICENSE" ))
92109
93110 def get_outputs (self ):
94111 outputs = _install .get_outputs (self )
0 commit comments