diff --git a/scripts/update_python_zip.py b/scripts/update_python_zip.py index f5bfba3b0e1b..fa8898b1e8d6 100755 --- a/scripts/update_python_zip.py +++ b/scripts/update_python_zip.py @@ -10,6 +10,9 @@ The port's version, source checksum and patches are read at that vcpkg tag, so the zip matches the Python that vcpkg builds. Run it with that Python minor version (e.g. `uv run --python 3.12`), or have `uv` on PATH and the script re-runs itself under the right version. + +The Windows builds of MREmbeddedPython run it with vcpkg's python.exe to put the zip next to +python3XY.dll; the repository no longer stores it. """ import argparse import hashlib diff --git a/source/MREmbeddedPython/CMakeLists.txt b/source/MREmbeddedPython/CMakeLists.txt index 64d36f262c85..d91ea51822fd 100644 --- a/source/MREmbeddedPython/CMakeLists.txt +++ b/source/MREmbeddedPython/CMakeLists.txt @@ -35,12 +35,7 @@ IF(MR_PCH) target_precompile_headers(${PROJECT_NAME} REUSE_FROM MRPch) ENDIF() -# On Windows, copy the zipped Python environment to the output directory. IF(WIN32) - file( - COPY ${MESHLIB_THIRDPARTY_DIR}/python/python${Python_VERSION_MAJOR}${Python_VERSION_MINOR}.zip - DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} - ) # The standard library's extension modules (_socket, _ssl, _sqlite3, ...) go to DLLs/, which Python puts on sys.path; # the DLLs they need go next to the executable, where most of them already are and the loader finds them IF(DEFINED VCPKG_INSTALLED_DIR AND DEFINED VCPKG_TARGET_TRIPLET) @@ -49,6 +44,20 @@ IF(WIN32) file(GLOB PYTHON_EXTENSION_DEPENDENCIES ${PYTHON_DLLS_DIR}/*.dll) file(COPY ${PYTHON_EXTENSION_MODULES} DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/DLLs) file(COPY ${PYTHON_EXTENSION_DEPENDENCIES} DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) + + # The pure-Python standard library, python3XY.zip, built from the CPython sources of vcpkg's python3 port + # by that port's own python.exe; rebuilt only when the script or that Python changes + set(VCPKG_PYTHON ${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/tools/python3/python.exe) + ENDIF() + IF(DEFINED VCPKG_PYTHON AND EXISTS ${VCPKG_PYTHON}) + set(PYTHON_ZIP_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/../../scripts/update_python_zip.py) + set(PYTHON_ZIP ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/python${Python_VERSION_MAJOR}${Python_VERSION_MINOR}.zip) + add_custom_command( + OUTPUT ${PYTHON_ZIP} + COMMAND ${VCPKG_PYTHON} ${PYTHON_ZIP_SCRIPT} --output ${PYTHON_ZIP} + DEPENDS ${PYTHON_ZIP_SCRIPT} ${VCPKG_PYTHON} + ) + add_custom_target(MREmbeddedPythonZip ALL DEPENDS ${PYTHON_ZIP}) ENDIF() ENDIF() diff --git a/source/MREmbeddedPython/MREmbeddedPython.vcxproj b/source/MREmbeddedPython/MREmbeddedPython.vcxproj index e66e993dfb12..2cc5fc934cc4 100644 --- a/source/MREmbeddedPython/MREmbeddedPython.vcxproj +++ b/source/MREmbeddedPython/MREmbeddedPython.vcxproj @@ -19,9 +19,6 @@ - - Document - @@ -140,6 +137,14 @@ + + + + \ No newline at end of file diff --git a/thirdparty/licenses/manifest.json b/thirdparty/licenses/manifest.json index 865b067416eb..bf773b8de0bc 100644 --- a/thirdparty/licenses/manifest.json +++ b/thirdparty/licenses/manifest.json @@ -411,13 +411,14 @@ "upstream": "https://www.python.org", "license_source": "https://raw.githubusercontent.com/python/cpython/3.12/LICENSE", "source": { - "type": "hash", - "track": [ - "thirdparty/python/python311.zip", - "thirdparty/python/python312.zip" + "type": "vcpkg-registry", + "ports": [ + "python3" ] }, - "version": "35ba61c359222abe" + "version": { + "python3": "3.12.13#1" + } }, { "id": "pybind11", diff --git a/thirdparty/python/python311.zip b/thirdparty/python/python311.zip deleted file mode 100644 index 5241e9bf51ee..000000000000 Binary files a/thirdparty/python/python311.zip and /dev/null differ diff --git a/thirdparty/python/python312.zip b/thirdparty/python/python312.zip deleted file mode 100644 index 3bb978717ca9..000000000000 Binary files a/thirdparty/python/python312.zip and /dev/null differ diff --git a/thirdparty/python/readme.md b/thirdparty/python/readme.md deleted file mode 100644 index 7cd17b4e6b5b..000000000000 --- a/thirdparty/python/readme.md +++ /dev/null @@ -1,2 +0,0 @@ -python3xy.zip archives from Windows embeddable package (64-bit) -https://www.python.org/downloads/windows/ \ No newline at end of file