Skip to content
Open
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
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -691,6 +691,9 @@ if(pyroot)
set(PYTESTS_WILLFAIL WILLFAIL)
endif()

#---Insert Python metadata for ROOT import package----------------------------------------------
include(InstallPythonMetadata)

#---Configure Testing using CTest----------------------------------------------------------------
configure_file(${CMAKE_SOURCE_DIR}/cmake/modules/CTestCustom.cmake ${CMAKE_BINARY_DIR} COPYONLY)
if(testing)
Expand Down
12 changes: 12 additions & 0 deletions cmake/modules/InstallPythonMetadata.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Installs Python METADATA and INSTALLER files for compatibility with importlib.metadata
# The presence of INSTALLER (along with intentionally neglecting RECORD) prevents
# package managers from uninstalling or otherwise touching the ROOT import package if
# it wasn't installed via a wheel.
# See: https://packaging.python.org/en/latest/specifications/recording-installed-packages/

# scikit-build-core handles metadata so only do this for non-wheel builds to avoid conflict
if(NOT _wheel_build)
configure_file("${CMAKE_SOURCE_DIR}/config/METADATA.in" "${CMAKE_BINARY_DIR}/dist-info/METADATA" @ONLY NEWLINE_STYLE UNIX)
file(WRITE "${CMAKE_BINARY_DIR}/dist-info/INSTALLER" "CMake")
install(DIRECTORY "${CMAKE_BINARY_DIR}/dist-info/" DESTINATION "${CMAKE_INSTALL_PYTHONDIR}/root-${ROOT_VERSION}.dist-info")
endif()
1 change: 1 addition & 0 deletions cmake/modules/RootBuildOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ option(rootbench "Build rootbench if rootbench exists in root or if it is a sibl
option(roottest "Build roottest (implies testing=ON)" OFF)
option(testing "Enable testing with CTest" OFF)
option(asan "Build ROOT with address sanitizer instrumentation" OFF)
option(_wheel_build "ROOT is being packaged as a wheel, do not install .dist-info metadata" OFF)

set(gcctoolchain "" CACHE PATH "Set path to GCC toolchain used to build llvm/clang")

Expand Down
3 changes: 3 additions & 0 deletions config/METADATA.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Metadata-Version: 2.2
Name: root
Version: @ROOT_VERSION@
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ opengl="OFF"
runtime_cxxmodules="ON"
fail-on-missing="ON"

# Prevent CMake from producing its own .dist-info metadata
_wheel_build="ON"

# Explicitly list components that gminimal implicitly turns off as documentation
# tmva-pymva and tpython are disabled for manylinux compatibility
# see https://peps.python.org/pep-0513/#libpythonx-y-so-1
Expand Down