[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Adding Cygwin and MSYS2 to DEPENDENCIES
From: |
Bruno Haible |
Subject: |
Re: Adding Cygwin and MSYS2 to DEPENDENCIES |
Date: |
Fri, 03 May 2024 00:50:26 +0200 |
Collin Funk wrote:
> Ah, good point. I didn't realize it was possible to use a native
> Windows Python3 (os.name == 'nt') with Cygwin tools.
It appears that's what the original reporter is doing [1]: you see
file names with backslashes and you see Windows error codes being
reported, rather than POSIX error codes.
> What would be the proper way to invoke 'sh' there? For example this
> command in GLTestDir.py:
>
> command = f'patch {shlex.quote(test_driver)} < {shlex.quote(diff)}'
> try:
> result = sp.call(command, shell=True, stdout=sp.DEVNULL,
> stderr=sp.DEVNULL)
> except OSError as exc:
> ...
>
> Would the following be correct?
>
> command = ['sh', '-c', f'patch {shlex.quote(test_driver)} <
> {shlex.quote(diff)}']
> try:
> result = sp.call(command, stdout=sp.DEVNULL, stderr=sp.DEVNULL)
> except OSError as exc:
> ...
Yes, this looks correct. But it needs to be conditionalized, so that we continue
to keep the simpler (and often also faster) code on Unix.
Bruno
[1] https://lists.gnu.org/archive/html/bug-gnulib/2024-04/msg00543.html
- Adding Cygwin and MSYS2 to DEPENDENCIES, Collin Funk, 2024/05/01
- Re: Adding Cygwin and MSYS2 to DEPENDENCIES, Bruno Haible, 2024/05/01
- Re: Adding Cygwin and MSYS2 to DEPENDENCIES, Collin Funk, 2024/05/01
- Re: Adding Cygwin and MSYS2 to DEPENDENCIES, Bruno Haible, 2024/05/02
- Re: Adding Cygwin and MSYS2 to DEPENDENCIES, Collin Funk, 2024/05/02
- Re: Adding Cygwin and MSYS2 to DEPENDENCIES, Bruno Haible, 2024/05/02
- Re: Adding Cygwin and MSYS2 to DEPENDENCIES, Collin Funk, 2024/05/02
- Re: Adding Cygwin and MSYS2 to DEPENDENCIES,
Bruno Haible <=
- Re: Adding Cygwin and MSYS2 to DEPENDENCIES, Collin Funk, 2024/05/02