Align Python in the Windows dev tree with the install layout#262
Open
OlafRocket wants to merge 1 commit into
Open
Align Python in the Windows dev tree with the install layout#262OlafRocket wants to merge 1 commit into
OlafRocket wants to merge 1 commit into
Conversation
Mirrors the install-time Python layout in the build tree on Windows so embedded Python initializes and the xstudio Python package is importable when running build/run_xstudio.bat from a fresh dev build (no cmake --install required). - src/embedded_python/src/CMakeLists.txt: stage vcpkg's tools/python3 into build/bin/python3/ at build time via cmake -E copy_directory_if_different (incremental; ~150 MB on first build, near-zero on subsequent builds). Add configure-time guard for missing vcpkg python tree. - python/CMakeLists.txt: on Windows, replace pip install . with cmake -E copy_directory_if_different of python/src/xstudio/ into build/bin/python3/Lib/site-packages/xstudio/. Update python_module target's DEPENDS for the new output path. Add an explicit Windows install(DIRECTORY ...) rule for the xstudio package (previously absent. Linux/macOS branches untouched. - src/python_module/src/CMakeLists.txt: on Windows, route the __pybind_xstudio.pyd LIBRARY_OUTPUT_DIRECTORY to build/bin/python3/Lib/site-packages/xstudio/core/ built directly at the final location, .pdb co-located for debugger. macOS and Linux unchanged. Install destination contents unchanged. Signed-off-by: Olaf Razzoli <olaf.razzoli@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Linked issues
None.
Summarize your change.
Makes embedded Python initialize and the xstudio Python package
importable when running
build\run_xstudio.batdirectly from a freshWindows dev build (no
cmake --installrequired).Describe the reason for the change.
Follow a previous PR which aligned the Windows dev tree with the
install layout for resources under
share/xstudio/. Python was the lastbroken piece:
xstudio_root()-derivedPYTHONHOMEisbuild/bin/python3/, but nothing stages vcpkg'stools/python3/to thatlocation at build time (only at install time).
Py_Initializefails;EmbeddedPython::setup()catches the exception and logs "Failed to setupAPI"; Python features are unavailable for the rest of the dev session.
This PR mirrors the install rules' destinations in the dev build tree on
Windows.
Describe what you have tested and on which operating system.
Windows 10 Pro x64 with Visual Studio 2022, Qt 6.5.3 (msvc2019_64),
vcpkg, Ninja generator (preset WinNinjaReleaseLocal):
build/: cmake configure + ninja buildsucceed.
build/bin/python3/populated with vcpkg's tools/python3contents plus xstudio package and __pybind_xstudio.pyd.
build/bin/python3/python.exe -c "import xstudio; from xstudio.core import *"succeeds, confirming the package layout and.pyd are reachable.
build\run_xstudio.bat: launches with no "Failed to setup API"warning. The
picture_in_picturetoggle in the bottom bar isfunctional, confirming stock Python plugins are loaded via
XSTUDIO_LOCAL_PLUGIN_PATH→load_plugins_in_path().cmake --install build --prefix install_test: install tree byte-identicalto current develop.
install_test/python/xstudio/is not present,but this was already true on upstream/develop since the rule that
produced that location was removed before this PR.
macOS and Linux: not retested as those code paths are untouched. All new
branches are guarded with
if(WIN32).Add a list of changes, and note any that might need special attention during the review.
src/embedded_python/src/CMakeLists.txt: add a Windows-only build-timestage step that copies vcpkg's
tools/python3/tobuild/bin/python3/usingcmake -E copy_directory_if_different.python/CMakeLists.txt:python -m pip install .invocation with
cmake -E copy_directory_if_differentofpython/src/xstudio/tobuild/bin/python3/Lib/site-packages/xstudio/. Update thepython_modulecustom target'sDEPENDSto track the new outputpath.
install(DIRECTORY ${WIN_PYTHON_SITE} DESTINATION bin/python3/Lib/site-packages)rule. Previously noexplicit Windows install rule existed for the xstudio
.pyfiles;they reached the installer only as a side-effect of
pip install .mutating vcpkg's
tools/python3/tree before the wholesale installrule for that tree ran.
src/python_module/src/CMakeLists.txt: add WIN32 branch inOUTPUT_DIRselection soLIBRARY_OUTPUT_DIRECTORYfor__pybind_xstudio.pydis the dev-tree mirror of its install location.The build-tree source paths of install rules changed (POSIX-style
bin/python/lib/python3.11/site-packages/is gone on Windows; replacedwith Windows-style
bin/python3/Lib/site-packages/), but the installdestination paths are byte-identical.
If possible, provide screenshots.
N/A — build system change with no UI impact.