From 482c6092b442f7ff3750b8c0e9bd1587bc24a4c6 Mon Sep 17 00:00:00 2001 From: na-trium-144 <100704180+na-trium-144@users.noreply.github.com> Date: Mon, 18 Nov 2024 03:56:20 +0900 Subject: [PATCH] do not raise error where cygpath is not available --- mesonbuild/modules/external_project.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/mesonbuild/modules/external_project.py b/mesonbuild/modules/external_project.py index 572aba8a08ec..8e675bacc7f1 100644 --- a/mesonbuild/modules/external_project.py +++ b/mesonbuild/modules/external_project.py @@ -116,17 +116,19 @@ def _configure(self, state: 'ModuleState') -> None: configure_path = Path(self.src_dir, self.configure_command) configure_prog = state.find_program(configure_path.as_posix()) configure_cmd = configure_prog.get_command() - # On Windows the configure command should be converted to - # unix style path by cygpath command, + # On Cygwin, MSYS2 and GitBash the configure command should be + # converted to unix style path by cygpath command, # because the colon in the drive letter breaks many configure scripts. + # Do nothing on other environment where cygpath is not available. if ( configure_path.drive and len(configure_cmd) >= 2 and configure_cmd[-1] == configure_path.as_posix() ): - cygpath = state.find_program('cygpath').get_command() - _p, o, _e = Popen_safe(cygpath + [configure_cmd[-1]]) - configure_cmd = configure_cmd[:-1] + [Path(o.strip("\n")).as_posix()] + cygpath = state.find_program('cygpath', required=False) + if cygpath.found(): + _p, o, _e = Popen_safe(cygpath.get_command() + [configure_cmd[-1]]) + configure_cmd = configure_cmd[:-1] + [Path(o.strip("\n")).as_posix()] workdir = self.build_dir self.make = state.find_program('make').get_command()