On Fri, 26 Jun 2026 at 01:55, Jun Omae <[email protected]> wrote: > On 2026/06/26 2:38, Ivan Zhakov wrote: > > > > [...] > > > >> 2. On Mac OS, there is an issue where FindPython3() in CMake > locates a different Python binary that doesn't match `python` from the > command line [1]. > >> > >> I still need to sort this part out. > > > > > > It probably finds /usr/bin/python3 by default, which is Python > 3.9 on recent versions of macOS. I think you'll have to set the > Python3_ROOT_DIR hint. Given the python binary you get on the command line, > try this: > > > > python3 -c 'import pathlib, sys; > print(str(pathlib.Path(sys.executable).resolve().parent.parent))' > > > > > > Haven't tested this yet, but thanks, it looks promising. > > > > I have implemented this approach in r1935637 < > https://svn.apache.org/r1935637> and it worked. Thanks! > > > > -- > > Ivan Zhakov > > Instead of using `Python3_*` hints, why not simply use the > `Python3_EXECUTABLE` hint? > See also > https://github.com/jun66j5/subversion/actions/runs/28207033484/job/83559921680 > > [[[ > diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml > index 7ec51f1b8..37acfb894 100644 > --- a/.github/workflows/cmake.yml > +++ b/.github/workflows/cmake.yml > @@ -186,12 +186,6 @@ jobs: > if: runner.os == 'macOS' > run: python -m pip -v --disable-pip-version-check install > lxml==6.1.0 rnc2rng==2.7.0 > > - - name: Set platform-specific values > - id: platform > - run: | > - $PYTHON_ROOT=$(python -c 'import pathlib, sys; > print(str(pathlib.Path(sys.executable).resolve().parent.parent))') > - "python_root=$PYTHON_ROOT" >> "$env:GITHUB_OUTPUT" > - > - name: Use LF for Git checkout > run: | > git config --global core.autocrlf false > @@ -214,10 +208,7 @@ jobs: > -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/installdir > -DVCPKG_TARGET_TRIPLET=${{ matrix.vcpkg_triplet }} > -DSVN_TEST_CONFIGURE_FOR_PARALLEL=ON > - -DPython3_ROOT_DIR="${{ steps.platform.outputs.python_root }}" > - -DPython3_FIND_REGISTRY=NEVER > - -DPython3_FIND_STRATEGY=LOCATION > - -DPython3_FIND_UNVERSIONED_NAMES=FIRST > + -DPython3_EXECUTABLE="$( (Get-Command python).Path )" > ${{ matrix.extra_config_opts }} > > - name: Build CMake > ]]] > > I agree that this approach looks simpler, but I think that we should avoid directly setting the module artifacts unless absolutely necessary.
The documentation [1] lists this as a possibility: [[[ To solve special cases, it is possible to specify directly the artifacts by setting the following variables ]]] but the problem is that then we'd also have to specify other artifacts as well (Python3_LIBRARY, Python3_INCLUDE_DIR, ...) or the result can be inconsistent: [[[ If more than one artifact is specified, it is the user's responsibility to ensure the consistency of the various artifacts ]]] [1]: https://cmake.org/cmake/help/latest/module/FindPython3.html#artifacts-specification -- Ivan Zhakov

