Skip to content

Commit 870fbb0

Browse files
committed
Address review comments
1 parent aaffbd8 commit 870fbb0

File tree

6 files changed

+23
-47
lines changed

6 files changed

+23
-47
lines changed

bindings/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ if(pyroot)
1717
endif()
1818
endif()
1919

20-
if(tpython AND NOT (DEFINED ROOT_WHEEL_BUILD AND ROOT_WHEEL_BUILD))
20+
if(tpython)
2121
add_subdirectory(tpython)
2222
endif()
2323

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

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -8,29 +8,9 @@
88
# For the list of contributors see $ROOTSYS/README/CREDITS. #
99
################################################################################
1010

11-
# First, check for presence of important dependencies
11+
import importlib
1212
import os
13-
import shlex
1413
import sys
15-
import subprocess
16-
import textwrap
17-
18-
import platform
19-
if platform.system() != "Windows":
20-
try:
21-
# Mimic what cling does to find standard headers include path
22-
cmd = shlex.split('c++ -xc++ -E -v /dev/null')
23-
env = os.environ
24-
env.update({'LC_ALL': 'C'})
25-
subprocess.run(cmd, env=env, check=True,
26-
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
27-
except Exception as e:
28-
msg = (
29-
"Could not find a C++ compiler when importing ROOT. Make sure a C++ compiler as well as the C++ standard "
30-
"libraries are installed. For example, run `[apt,dnf] install g++` or follow similar instructions for your "
31-
"distribution. For more info, visit https://root.cern/install/dependencies"
32-
)
33-
raise ImportError(textwrap.fill(msg, width=80)) from e
3414

3515
# Prevent cppyy's check for the PCH
3616
os.environ["CLING_STANDARD_PCH"] = "none"

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
from ._numbadeclare import _NumbaDeclareDecorator
1212
from ._pythonization import pythonization
1313

14+
1415
class PyROOTConfiguration(object):
1516
"""Class for configuring PyROOT"""
1617

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

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,14 @@
66

77

88
def main() -> None:
9-
# Ensure all ROOT libraries are found at runtime by the process
10-
os.environ['LD_LIBRARY_PATH'] = os.path.join(ROOT_HOME, 'lib')
11-
# Finds the ROOT executable from the current installation directory
12-
bindir = os.path.join(ROOT_HOME, 'bin')
13-
rootexe = os.path.join(bindir, 'root.exe')
9+
# Find the ROOT executable from the current installation directory
10+
bindir = os.path.join(ROOT_HOME, "bin")
11+
rootexe = os.path.join(bindir, "root.exe")
1412
if not os.path.exists(rootexe):
1513
raise FileNotFoundError(
16-
f"Could not find 'root' executable in directory '{bindir}'. "
17-
"Something is wrong in the ROOT installation.")
14+
f"Could not find 'root.exe' executable in directory '{bindir}'. "
15+
"Something is wrong in the ROOT installation."
16+
)
1817
# Make sure command line arguments are preserved
1918
args = [rootexe] + sys.argv[1:]
2019
# Run the actual ROOT executable and return the exit code to the main Python process

cmake/modules/SearchInstalledSoftware.cmake

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -676,14 +676,12 @@ set(Python3_FIND_FRAMEWORK LAST)
676676

677677
# Even if we don't build PyROOT, one still need python executable to run some scripts
678678
list(APPEND python_components Interpreter)
679-
if(pyroot OR tmva-pymva)
680-
if(DEFINED ROOT_WHEEL_BUILD AND ROOT_WHEEL_BUILD)
681-
# We have to only look for the Python development module in order to be able to build ROOT with a pip backend
682-
# In particular, it is forbidden to link against libPython.so, see https://peps.python.org/pep-0513/#libpythonx-y-so-1
683-
list(APPEND python_components Development.Module)
684-
else()
685-
list(APPEND python_components Development)
686-
endif()
679+
if(pyroot AND NOT (tpython OR tmva-pymva))
680+
# We have to only look for the Python development module in order to be able to build ROOT with a pip backend
681+
# In particular, it is forbidden to link against libPython.so, see https://peps.python.org/pep-0513/#libpythonx-y-so-1
682+
list(APPEND python_components Development.Module)
683+
elseif(tpython OR tmva-pymva)
684+
list(APPEND python_components Development)
687685
endif()
688686
if(tmva-pymva)
689687
list(APPEND python_components NumPy)
@@ -1780,7 +1778,7 @@ if(pyroot)
17801778
endif()
17811779

17821780
#---Check for TPython---------------------------------------------------------------------
1783-
if(tpython AND NOT (DEFINED ROOT_WHEEL_BUILD AND ROOT_WHEEL_BUILD))
1781+
if(tpython)
17841782

17851783
if(NOT Python3_Development_FOUND)
17861784
if(fail-on-missing)

setup.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,16 @@
1919
generate the wheel with CPython extension metadata.
2020
"""
2121

22-
from setuptools import setup, find_packages, Extension
22+
import os
2323
import pathlib
24+
import shlex
25+
import subprocess
2426
import tempfile
27+
28+
from setuptools import Extension, find_packages, setup
2529
from setuptools.command.build import build as _build
2630
from setuptools.command.install import install as _install
2731

28-
import subprocess
29-
import os
30-
import shlex
31-
3232
# Get the long description from the README file
3333
SOURCE_DIR = pathlib.Path(__file__).parent.resolve()
3434
LONG_DESCRIPTION = (SOURCE_DIR / "README.md").read_text(encoding="utf-8")
@@ -50,7 +50,8 @@ def run(self):
5050
configure_command = shlex.split(
5151
"cmake -GNinja -Dccache=ON "
5252
"-Dgminimal=ON -Dasimage=ON -Dopengl=OFF " # Graphics
53-
"-Druntime_cxxmodules=ON -Drpath=ON -Dfail-on-missing=ON -DROOT_WHEEL_BUILD=ON " # Generic build configuration
53+
"-Druntime_cxxmodules=ON -Drpath=ON -Dfail-on-missing=ON " # Generic build configuration
54+
"-Dtmva-pymva=OFF -Dtpython=OFF " # Turn off explicitly components that link against libPython
5455
"-Dbuiltin_nlohmannjson=ON -Dbuiltin_tbb=ON -Dbuiltin_xrootd=ON " # builtins
5556
"-Dbuiltin_lz4=ON -Dbuiltin_lzma=ON -Dbuiltin_zstd=ON -Dbuiltin_xxhash=ON " # builtins
5657
"-Dpyroot=ON -Ddataframe=ON -Dxrootd=ON -Dssl=ON -Dimt=ON "
@@ -87,8 +88,6 @@ def run(self):
8788

8889
install_path = self._get_install_path()
8990

90-
lib_dir = os.path.join(INSTALL_DIR, "lib")
91-
9291
# Copy ROOT installation tree to the ROOT package directory in the pip installation path
9392
self.copy_tree(os.path.join(INSTALL_DIR, ROOT_BUILD_INTERNAL_DIRNAME), install_path)
9493

@@ -97,7 +96,6 @@ def run(self):
9796
# After the copy of the "mock" package structure from the ROOT installations, these are the
9897
# leftover directories that still need to be copied
9998
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"))
10199
self.copy_tree(os.path.join(INSTALL_DIR, "etc"), os.path.join(root_package_dir, "etc"))
102100
self.copy_tree(os.path.join(INSTALL_DIR, "fonts"), os.path.join(root_package_dir, "fonts"))
103101
self.copy_tree(os.path.join(INSTALL_DIR, "icons"), os.path.join(root_package_dir, "icons"))

0 commit comments

Comments
 (0)