wrap: Fix git exception not catched by interpreter
This is a regression introduced in Meson 0.56.0, it was fatal
error when optional dependencies fails to download their fallback
subproject.
@@ -31,7 +31,8 @@ import textwrap
from .._pathlib import Path
from . import WrapMode
from .. import coredata
-from ..mesonlib import verbose_git, quiet_git, GIT, ProgressBar, MesonException
+from ..mesonlib import quiet_git, GIT, ProgressBar, MesonException
+from .. import mesonlib
if T.TYPE_CHECKING:
import http.client
@@ -186,6 +187,15 @@ def get_directory(subdir_root: str, packagename: str) -> str:
return wrap.directory
return packagename
+def verbose_git(*args, **kwargs):
+ '''
+ Wrapper to convert GitException to WrapException caught in interpreter.
+ '''
+ try:
+ return mesonlib.verbose_git(*args, **kwargs)
+ except mesonlib.GitException as e:
+ raise WrapException(str(e))
+
class Resolver:
def __init__(self, source_dir: str, subdir: str, wrap_mode: WrapMode = WrapMode.default) -> None:
self.source_dir = source_dir
