Skip to content

Commit 10f048f

Browse files
pks-tgitster
authored andcommitted
meson: stop discovering native version of Python
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. 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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 16bd9f2 commit 10f048f

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

meson.build

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -866,9 +866,11 @@ if host_machine.system() == 'cygwin' or host_machine.system() == 'windows'
866866
endif
867867
build_options_config.set_quoted('X', executable_suffix)
868868

869-
python = import('python').find_installation('python3', required: get_option('python'))
870-
target_python = find_program('python3', native: false, required: python.found())
871-
if python.found()
869+
# Python is not used for our build system, but exclusively for git-p4.
870+
# Consequently we only need to determine whether Python is available for the
871+
# build target.
872+
target_python = find_program('python3', native: false, required: get_option('python'))
873+
if target_python.found()
872874
build_options_config.set('NO_PYTHON', '')
873875
else
874876
libgit_c_args += '-DNO_PYTHON'
@@ -1979,7 +1981,7 @@ if perl_features_enabled
19791981
subdir('perl')
19801982
endif
19811983

1982-
if python.found()
1984+
if target_python.found()
19831985
scripts_python = [
19841986
'git-p4.py'
19851987
]
@@ -2190,7 +2192,7 @@ summary({
21902192
'iconv': iconv.found(),
21912193
'pcre2': pcre2.found(),
21922194
'perl': perl_features_enabled,
2193-
'python': python.found(),
2195+
'python': target_python.found(),
21942196
}, section: 'Auto-detected features')
21952197

21962198
summary({

0 commit comments

Comments
 (0)