Skip to content

[Python] Don't include JsMVA in builds #19040

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 24 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ add_custom_command(OUTPUT ${stamp_file}


#---Copy files to the build area at build time---------------------------------
set(directories_to_copy etc test icons fonts macros tutorials)
set(directories_to_copy test icons fonts macros tutorials)
if(http)
list(APPEND directories_to_copy js)
endif()
Expand All @@ -337,6 +337,28 @@ foreach(dir_to_copy ${directories_to_copy})
DEPENDS ${artifacts_in})
endforeach()

#---Copy etc/* files individually to the build area at build time---------------------------------
# The reason why we don't copy these files with copy_directory as above is that
# we want to exclude a subset of the files.
file(GLOB_RECURSE artifact_files RELATIVE ${CMAKE_SOURCE_DIR} etc/*)

# Exclude the *.in files, just like in the install tree
list(FILTER artifact_files EXCLUDE REGEX "\.(in)$")

# Exclude etc/notebook/JsMVA
list(FILTER artifact_files EXCLUDE REGEX "^etc/notebook/JsMVA/")

foreach(artifact_file ${artifact_files})
add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/${artifact_file}
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_SOURCE_DIR}/${artifact_file} ${CMAKE_BINARY_DIR}/${artifact_file}
COMMENT "Copying ${CMAKE_SOURCE_DIR}/${artifact_file}"
DEPENDS ${CMAKE_SOURCE_DIR}/${artifact_file})
list(APPEND all_artifacts ${CMAKE_BINARY_DIR}/${artifact_file})
endforeach()

unset(artifact_files)


add_custom_target(move_artifacts DEPENDS ${stamp_file} ${all_artifacts})


Expand Down Expand Up @@ -606,6 +628,7 @@ if(NOT CMAKE_SOURCE_DIR STREQUAL CMAKE_INSTALL_PREFIX)
endif()
install(DIRECTORY etc/ DESTINATION ${CMAKE_INSTALL_SYSCONFDIR} USE_SOURCE_PERMISSIONS
${DIR_PERMISSIONS}
PATTERN "notebook/JsMVA" EXCLUDE
PATTERN "system.rootrc" EXCLUDE
PATTERN "system.rootauthrc" EXCLUDE
PATTERN "system.rootdaemonrc" EXCLUDE
Expand Down
12 changes: 6 additions & 6 deletions bindings/pyroot/pythonizations/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,12 @@ list(APPEND PYROOT_EXTRA_HEADERS
inc/TPyDispatcher.h)

set(py_sources
ROOT/JsMVA/DataLoader.py
ROOT/JsMVA/Factory.py
ROOT/JsMVA/JPyInterface.py
ROOT/JsMVA/JsMVAMagic.py
ROOT/JsMVA/OutputTransformer.py
ROOT/JsMVA/__init__.py
#ROOT/JsMVA/DataLoader.py
#ROOT/JsMVA/Factory.py
#ROOT/JsMVA/JPyInterface.py
#ROOT/JsMVA/JsMVAMagic.py
#ROOT/JsMVA/OutputTransformer.py
#ROOT/JsMVA/__init__.py
ROOT/_application.py
ROOT/_asan.py
ROOT/_facade.py
Expand Down
2 changes: 1 addition & 1 deletion bindings/pyroot/pythonizations/python/ROOT/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# For the list of contributors see $ROOTSYS/README/CREDITS. #
################################################################################

import importlib

Check failure on line 11 in bindings/pyroot/pythonizations/python/ROOT/__init__.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (F401)

bindings/pyroot/pythonizations/python/ROOT/__init__.py:11:8: F401 `importlib` imported but unused
import os
import sys

Expand All @@ -31,9 +31,9 @@
os.add_dll_directory(os.path.dirname(root_module_path)) # expected to be $ROOTSYS/bin

# Do setup specific to AddressSanitizer environments
from . import _asan

Check failure on line 34 in bindings/pyroot/pythonizations/python/ROOT/__init__.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (F401)

bindings/pyroot/pythonizations/python/ROOT/__init__.py:34:15: F401 `._asan` imported but unused; consider removing, adding to `__all__`, or using a redundant alias

import cppyy

Check failure on line 36 in bindings/pyroot/pythonizations/python/ROOT/__init__.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (I001)

bindings/pyroot/pythonizations/python/ROOT/__init__.py:34:1: I001 Import block is un-sorted or un-formatted

# Build cache of commonly used python strings (the cache is python intern, so
# all strings are shared python-wide, not just in PyROOT).
Expand All @@ -43,12 +43,12 @@
_cached_strings.append(sys.intern(s))

# Trigger the addition of the pythonizations
from ._pythonization import _register_pythonizations

Check failure on line 46 in bindings/pyroot/pythonizations/python/ROOT/__init__.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (E402)

bindings/pyroot/pythonizations/python/ROOT/__init__.py:46:1: E402 Module level import not at top of file

_register_pythonizations()

# Check if we are in the IPython shell
import builtins

Check failure on line 51 in bindings/pyroot/pythonizations/python/ROOT/__init__.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (E402)

bindings/pyroot/pythonizations/python/ROOT/__init__.py:51:1: E402 Module level import not at top of file

_is_ipython = hasattr(builtins, "__IPYTHON__")

Expand All @@ -73,8 +73,8 @@
__all__ = _PoisonedDunderAll()

# Configure ROOT facade module
import sys

Check failure on line 76 in bindings/pyroot/pythonizations/python/ROOT/__init__.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (E402)

bindings/pyroot/pythonizations/python/ROOT/__init__.py:76:1: E402 Module level import not at top of file
from ._facade import ROOTFacade

Check failure on line 77 in bindings/pyroot/pythonizations/python/ROOT/__init__.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (E402)

bindings/pyroot/pythonizations/python/ROOT/__init__.py:77:1: E402 Module level import not at top of file

Check failure on line 77 in bindings/pyroot/pythonizations/python/ROOT/__init__.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (I001)

bindings/pyroot/pythonizations/python/ROOT/__init__.py:76:1: I001 Import block is un-sorted or un-formatted

_root_facade = ROOTFacade(sys.modules[__name__], _is_ipython)
sys.modules[__name__] = _root_facade
Expand All @@ -85,8 +85,8 @@
# * https://docs.python.org/3/library/importlib.html#module-importlib.abc
#
# * https://python.plainenglish.io/metapathfinders-or-how-to-change-python-import-behavior-a1cf3b5a13ec
from importlib.abc import Loader, MetaPathFinder

Check failure on line 88 in bindings/pyroot/pythonizations/python/ROOT/__init__.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (E402)

bindings/pyroot/pythonizations/python/ROOT/__init__.py:88:1: E402 Module level import not at top of file
from importlib.machinery import ModuleSpec

Check failure on line 89 in bindings/pyroot/pythonizations/python/ROOT/__init__.py

View workflow job for this annotation

GitHub Actions / ruff

Ruff (E402)

bindings/pyroot/pythonizations/python/ROOT/__init__.py:89:1: E402 Module level import not at top of file
from importlib.util import spec_from_loader


Expand Down Expand Up @@ -180,7 +180,7 @@
ip = get_ipython()
if hasattr(ip, "kernel"):
import JupyROOT
from . import JsMVA
# from . import JsMVA

# Register cleanup
import atexit
Expand Down
Loading