git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 1/8] meson: stop discovering native version of Python

From
Justin Tobler <jltobler@gmail.com>
Date
Jul 8, 2025, 19:38 UTC
Message-ID
<4ql5wzqvcoxrcbi6cznavtnfzwmh72tevixwgotvsx4kzkbljv@a55yhjqqqnym>
In-Reply-To
<20250703-b4-pks-meson-cleanups-v1-1-2804c2932abe@pks.im>
On 25/07/03 11:28AM, Patrick Steinhardt wrote:
Show 9 quoted lines
> When Python features are enabled we search both for a native and
> non-native version of Python. This is wrong though: we don't use Python
> in our build process, so there is no need to search for it in the first
> place.
> 
> There is one location where we use the native version of Python, namely
> when deciding whether or not we want to wire up git-p4(1). This check is
> invalid though, as we shouldn't check for the build host to have Python,
> but for the target host.

Ok, we are using the native python version, but we should really care wether the target host has python.

Show 21 quoted lines
> Fix this invalid check to use the non-native version of Python and stop
> searching for a native version of Python altogether.
> 
> Signed-off-by: Patrick Steinhardt <ps@pks.im>
> ---
>  meson.build | 9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/meson.build b/meson.build
> index 7fea4a34d68..21fdff0f496 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -866,9 +866,8 @@ if host_machine.system() == 'cygwin' or host_machine.system() == 'windows'
>  endif
>  build_options_config.set_quoted('X', executable_suffix)
>  
> -python = import('python').find_installation('python3', required: get_option('python'))
> -target_python = find_program('python3', native: false, required: python.found())
> -if python.found()
> +target_python = find_program('python3', native: false, required: get_option('python'))
> +if target_python.found()

Ok, so here we are not actually using python to build, but instead need to know whether to include this build configuration which is dependent on the target host having python. Makes sense.

It might be nice to leave a comment here to explain this. The changes in this patch look good though.

Show 26 quoted lines
>    build_options_config.set('NO_PYTHON', '')
>  else
>    libgit_c_args += '-DNO_PYTHON'
> @@ -1979,7 +1978,7 @@ if perl_features_enabled
>    subdir('perl')
>  endif
>  
> -if python.found()
> +if target_python.found()
>    scripts_python = [
>      'git-p4.py'
>    ]
> @@ -2202,7 +2201,7 @@ summary({
>    'iconv': iconv.found(),
>    'pcre2': pcre2.found(),
>    'perl': perl_features_enabled,
> -  'python': python.found(),
> +  'python': target_python.found(),
>  }, section: 'Auto-detected features')
>  
>  summary({
> 
> -- 
> 2.50.0.195.g74e6fc65d0.dirty
> 
> 
Previous: Patrick SteinhardtNext: Patrick Steinhardt
Message 3 of 46 in “A handful of Meson cleanups and improvements”
  1. 0/8 A handful of Meson cleanups and improvementsPatrick Steinhardt, Jul 3, 2025
  2. 1/8 meson: stop discovering native version of PythonPatrick Steinhardt, Jul 3, 2025
  3. Justin ToblerJul 8, 2025
  4. Patrick SteinhardtJul 9, 2025
  5. 2/8 meson: stop printing 'https' option twice in our summariesPatrick Steinhardt, Jul 3, 2025
  6. 3/8 meson: improve summary of auto-detected featuresPatrick Steinhardt, Jul 3, 2025
  7. Justin ToblerJul 8, 2025
  8. 4/8 meson: clean up unnecessary variablesPatrick Steinhardt, Jul 3, 2025
  9. 5/8 meson: fix lookup of shell on MINGW64Patrick Steinhardt, Jul 3, 2025
  10. 6/8 meson: fix GIT_EXEC_PATH with overridden -Dlibexecdir=Patrick Steinhardt, Jul 3, 2025
  11. Ramsay JonesJul 3, 2025
  12. Patrick SteinhardtJul 8, 2025
  13. 7/8 meson: update subproject wrappersPatrick Steinhardt, Jul 3, 2025
  14. 8/8 ci: use Meson's new `--slice` optionPatrick Steinhardt, Jul 3, 2025
  15. Junio C HamanoJul 8, 2025
  16. Jeff KingJul 8, 2025
  17. Jeff KingJul 8, 2025
  18. Junio C HamanoJul 8, 2025
  19. Patrick SteinhardtJul 8, 2025
  20. 0/8 A handful of Meson cleanups and improvementsPatrick Steinhardt, Jul 8, 2025
  21. 1/8 meson: stop discovering native version of PythonPatrick Steinhardt, Jul 8, 2025
  22. 2/8 meson: stop printing 'https' option twice in our summariesPatrick Steinhardt, Jul 8, 2025
  23. 3/8 meson: improve summary of auto-detected featuresPatrick Steinhardt, Jul 8, 2025
  24. 4/8 meson: clean up unnecessary variablesPatrick Steinhardt, Jul 8, 2025
  25. 5/8 meson: fix lookup of shell on MINGW64Patrick Steinhardt, Jul 8, 2025
  26. Justin ToblerJul 8, 2025
  27. 6/8 meson: fix GIT_EXEC_PATH with overridden -Dlibexecdir=Patrick Steinhardt, Jul 8, 2025
  28. 7/8 meson: update subproject wrappersPatrick Steinhardt, Jul 8, 2025
  29. 8/8 ci: use Meson's new `--slice` optionPatrick Steinhardt, Jul 8, 2025
  30. 0/8 A handful of Meson cleanups and improvementsPatrick Steinhardt, Jul 9, 2025
  31. 1/8 meson: stop discovering native version of PythonPatrick Steinhardt, Jul 9, 2025
  32. Junio C HamanoJul 9, 2025
  33. Justin ToblerJul 9, 2025
  34. Eli SchwartzJul 9, 2025
  35. Junio C HamanoJul 9, 2025
  36. 2/8 meson: stop printing 'https' option twice in our summariesPatrick Steinhardt, Jul 9, 2025
  37. Junio C HamanoJul 9, 2025
  38. 3/8 meson: improve summary of auto-detected featuresPatrick Steinhardt, Jul 9, 2025
  39. Toon ClaesJul 10, 2025
  40. Junio C HamanoJul 10, 2025
  41. 4/8 meson: clean up unnecessary variablesPatrick Steinhardt, Jul 9, 2025
  42. 5/8 meson: fix lookup of shell on MINGW64Patrick Steinhardt, Jul 9, 2025
  43. 6/8 meson: fix GIT_EXEC_PATH with overridden -Dlibexecdir=Patrick Steinhardt, Jul 9, 2025
  44. 7/8 meson: update subproject wrappersPatrick Steinhardt, Jul 9, 2025
  45. 8/8 ci: use Meson's new `--slice` optionPatrick Steinhardt, Jul 9, 2025
  46. Justin ToblerJul 9, 2025

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.