SFTtech / SFTtech/openage

Document optional possibility to hardcode a Python directory

Open
#1,246 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area: buildsystem documentation improvement
Dominant language
Python
Stars
14.4k
Forks
1.3k
PR merge metrics
No merged PRs in 30d

Description

With the update to Python3.cmake -DPYTHON_DIR is used as a HINT to search for a suitable Python3 version.

Sometimes just hinting towards a location is not enough and you would like to hardcode that and let the process fail miserably if nothing is found.

To keep the hinting behaviour of -DPYTHON_DIR=<path> we should add -DFORCE_PYTHON_DIR=TRUE that will switch from hinting => enforcing the search in PYTHON_DIR and nowhere else.

The whole processing in packaged CMake runs in an extra file from Python3.cmake kept in FindPython/Support.cmake that we would need to adopt to buildsystem/modules/FindPython/Support.cmake to let it be used by CMake and overwrite default behaviour.

Be aware, that we are limited to the 3.12.x version and functionality of CMake as this is our minimum version requirement, there are newer version of the files and It would make sense to test how far we can update that with the usage of our CMake 3.12.x minimum requirement. In the newer version there is a find virtual environment handling included that could be interesting for example.

Python3_FIND_VIRTUALENV
This variable defines the handling of virtual environments. It is meaningfull
only when a virtual environment is active (i.e. the activate script has
been evaluated). In this case, it takes precedence over
Python3_FIND_REGISTRY and CMAKE_FIND_FRAMEWORK variables.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with buildsystem/modules/FindPython.cmake and compare its Python3.cmake processing with CMake 3.12.x's FindPython/Support.cmake. Check the referenced newer CMake files for relevant virtual-environment handling without exceeding the minimum version. Done means a FORCE_PYTHON_DIR option enforces the supplied path and fails when no suitable Python is found, while PYTHON_DIR retains hinting behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
cmake, python
Domain
build-system
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.