Instead of warning and failing, just do the right thing

After df83ad933b "fix harfbuzz build with
--enable-python=fully-internal on linux", my --enable-python=fully-internal
Linux builds that auto-detect MESON=/usr/bin/meson started to emit a configure
warning

> * WARNING : using internal python with a meson launcher might not work, best to use MESON=/path/to/meson.py in autogen.input

and then fail to build ExternalProject_harfbuzz with

> Traceback (most recent call last):
>   File "/home/sberg/lo/core/instdir/program/python-core-3.11.12/lib/importlib/metadata/__init__.py", line 563, in from_name
>     return next(cls.discover(name=name))
>            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> StopIteration
>
> During handling of the above exception, another exception occurred:
>
> Traceback (most recent call last):
>   File "/usr/bin/meson", line 33, in <module>
>     sys.exit(load_entry_point('meson==1.7.0', 'console_scripts', 'meson')())
>              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>   File "/usr/bin/meson", line 22, in importlib_load_entry_point
>     for entry_point in distribution(dist_name).entry_points
>                        ^^^^^^^^^^^^^^^^^^^^^^^
>   File "/home/sberg/lo/core/instdir/program/python-core-3.11.12/lib/importlib/metadata/__init__.py", line 982, in distribution
>     return Distribution.from_name(distribution_name)
>            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>   File "/home/sberg/lo/core/instdir/program/python-core-3.11.12/lib/importlib/metadata/__init__.py", line 565, in from_name
>     raise PackageNotFoundError(name)
> importlib.metadata.PackageNotFoundError: No package metadata was found for meson

So better add back the idea from 736998ccef "Only
run meson from python when it apparently needs to be" (that had been removed
with df83ad933b "fix harfbuzz build with
--enable-python=fully-internal on linux") to treat a Meson executable that
doesn't advertise itself as being a Python script as just any plain executable,
which we don't throw at our --enable-python=fully-internal interpreter.  (Just
like, say, an Emscripten build of LO uses an emcc compiler executable that
internally uses Python, and onto which we don't force our
--enable-python=fully-internal interpreter, either.)

Change-Id: I13965ef08043f350e9614bd61a469708b7faf27b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184626
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
This commit is contained in:
Stephan Bergmann
2025-04-25 20:38:53 +02:00
parent edc9277e0f
commit dfbdb858e2
3 changed files with 6 additions and 4 deletions
+1
View File
@@ -504,6 +504,7 @@ export MDDS_LIBS=$(gb_SPACE)@MDDS_LIBS@
export MERGELIBS=@MERGELIBS@
export MERGELIBS_MORE=@MERGELIBS_MORE@
MESON=@MESON@
MESON_NO_PYTHON=@MESON_NO_PYTHON@
export ML_EXE=@ML_EXE@
export MOC5=@MOC5@
export MOC6=@MOC6@
+3 -2
View File
@@ -11463,6 +11463,7 @@ if test "$COM" = "MSC"; then # override the above
HARFBUZZ_LIBS='$(gb_UnpackedTarball_workdir)/harfbuzz/builddir/src/libharfbuzz.a $(GRAPHITE_LIBS)'
fi
MESON_NO_PYTHON=
if test "$with_system_harfbuzz" = "yes"; then
if test "$with_system_graphite" = "no"; then
AC_MSG_ERROR([--with-system-graphite must be used when --with-system-harfbuzz is used])
@@ -11489,8 +11490,7 @@ else
fi
if test -z "$PYTHON_FOR_BUILD"; then
if test "$(basename $MESON)" = "$(basename -s .py $MESON)"; then
AC_MSG_WARN([using internal python with a meson launcher might not work, best to use MESON=/path/to/meson.py in autogen.input])
add_warning "using internal python with a meson launcher might not work, best to use MESON=/path/to/meson.py in autogen.input"
MESON_NO_PYTHON=TRUE
fi
else
AC_MSG_CHECKING([whether meson can be run with "$PYTHON_FOR_BUILD $MESON"])
@@ -11502,6 +11502,7 @@ else
fi
fi
fi
AC_SUBST(MESON_NO_PYTHON)
if test -z "$NINJA" || test "$NINJA" = 'assumed to be available from Visual Studio'; then
x_NINJA=[\#]
else
+2 -2
View File
@@ -47,7 +47,7 @@ $(call gb_ExternalProject_get_state_target,harfbuzz,build) : | $(call gb_Externa
$(call gb_ExternalProject_run,build,\
PKG_CONFIG_PATH="${PKG_CONFIG_PATH}$(LIBO_PATH_SEPARATOR)$(gb_UnpackedTarball_workdir)/graphite$(if $(SYSTEM_ICU),,$(LIBO_PATH_SEPARATOR)$(gb_UnpackedTarball_workdir)/icu)" \
PYTHONWARNINGS= \
$(call gb_ExternalExecutable_get_command,python) $(MESON) setup builddir \
$(if $(MESON_NO_PYTHON),,$(call gb_ExternalExecutable_get_command,python)) $(MESON) setup builddir \
-Ddefault_library=static -Dbuildtype=$(if $(ENABLE_DEBUG),debug,release) \
-Dauto_features=disabled \
-Dcpp_std=$(subst -std:,,$(subst -std=,,$(filter -std%,$(CXXFLAGS_CXX11)))) \
@@ -57,7 +57,7 @@ $(call gb_ExternalProject_get_state_target,harfbuzz,build) : | $(call gb_Externa
-Dicu_builtin=true \
-Dgraphite2=enabled \
$(if $(filter-out $(BUILD_PLATFORM),$(HOST_PLATFORM))$(WSL),--cross-file cross-file.txt) && \
$(call gb_ExternalExecutable_get_command,python) $(MESON) compile -C builddir lib \
$(if $(MESON_NO_PYTHON),,$(call gb_ExternalExecutable_get_command,python)) $(MESON) compile -C builddir lib \
$(if $(verbose),--verbose) \
)
$(call gb_Trace_EndRange,harfbuzz,EXTERNAL)