SHA256
1
0
forked from pool/vtk
vtk/0001-Always-generate-Python-Metadata-when-WRAP_PYTHON-is-.patch

96 lines
2.8 KiB
Diff
Raw Permalink Normal View History

2021-11-25 01:20:17 +01:00
From a08e2a67c1e6694ba2eb2631c7e8e371bd055b46 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20Br=C3=BCns?= <stefan.bruens@rwth-aachen.de>
Date: Sat, 20 Nov 2021 23:26:05 +0100
Subject: [PATCH] Always generate Python Metadata when WRAP_PYTHON is active
Python Metadata in accordance with PEP 314 is not only used by wheels
(PEP 427/PEP 491), but can also used for `python setup.py
install_egg_info`.
The latter can be used to make a system wide VTK installation available
for other python packages (e.g. installed via pip) which require VTK.
Without the metadata, pip will not find it and always try to download the
wheel.
---
CMake/vtkPythonMetadata.cmake | 17 +++++++++++++++++
CMake/vtkWheelPreparation.cmake | 18 -----------------
CMakeLists.txt | 3 ++-
3 files changed, 19 insertions(+), 19 deletions(-)
create mode 100644 CMake/vtkPythonMetadata.cmake
diff --git a/CMake/vtkPythonMetadata.cmake b/CMake/vtkPythonMetadata.cmake
new file mode 100644
index 0000000000..44fb591321
--- /dev/null
+++ b/CMake/vtkPythonMetadata.cmake
@@ -0,0 +1,17 @@
+configure_file(
+ "${CMAKE_CURRENT_LIST_DIR}/setup.py.in"
+ "${CMAKE_BINARY_DIR}/setup.py"
+ @ONLY)
+configure_file(
+ "${CMAKE_CURRENT_LIST_DIR}/MANIFEST.in.in"
+ "${CMAKE_BINARY_DIR}/MANIFEST.in"
+ @ONLY)
+configure_file(
+ "${CMAKE_SOURCE_DIR}/Copyright.txt"
+ "${CMAKE_BINARY_DIR}/LICENSE"
+ COPYONLY)
+configure_file(
+ "${CMAKE_SOURCE_DIR}/README.md"
+ "${CMAKE_BINARY_DIR}/README.md"
+ COPYONLY)
+
diff --git a/CMake/vtkWheelPreparation.cmake b/CMake/vtkWheelPreparation.cmake
index 0a4c4786d0..df56a3d98c 100644
--- a/CMake/vtkWheelPreparation.cmake
+++ b/CMake/vtkWheelPreparation.cmake
@@ -84,22 +84,4 @@ elseif (UNIX)
endif ()
set(VTK_PYTHON_OPTIONAL_LINK ON)
-configure_file(
- "${CMAKE_CURRENT_LIST_DIR}/setup.py.in"
- "${CMAKE_BINARY_DIR}/setup.py"
- @ONLY)
-configure_file(
- "${CMAKE_CURRENT_LIST_DIR}/MANIFEST.in.in"
- "${CMAKE_BINARY_DIR}/MANIFEST.in"
- @ONLY)
-configure_file(
- "${CMAKE_SOURCE_DIR}/Copyright.txt"
- "${CMAKE_BINARY_DIR}/LICENSE"
- COPYONLY)
-configure_file(
- "${CMAKE_SOURCE_DIR}/README.md"
- "${CMAKE_BINARY_DIR}/README.md"
- COPYONLY)
-
-unset(license_file)
unset(wheel_data_dir)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 371ffd61a6..ccd4409251 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -447,6 +447,8 @@ if (VTK_WRAP_PYTHON)
TARGET_SPECIFIC_COMPONENTS "${VTK_TARGET_SPECIFIC_COMPONENTS}"
TARGET VTK::vtkpythonmodules)
+ include(vtkPythonMetadata)
+
if (APPLE AND VTK_WHEEL_BUILD)
list(REMOVE_ITEM CMAKE_INSTALL_RPATH
"@loader_path/.dylibs")
@@ -547,7 +549,7 @@ install(
# TODO: HeaderTest exclusions for memcheck.
-if (VTK_WHEEL_BUILD)
+if (VTK_WRAP_PYTHON)
include(vtkWheelFinalization)
endif ()
--
2.33.1