qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2 1/4] docs: Fixes build docs on msys2/mingw


From: Paolo Bonzini
Subject: Re: [PATCH v2 1/4] docs: Fixes build docs on msys2/mingw
Date: Thu, 15 Oct 2020 23:22:20 +0200



Il gio 15 ott 2020, 22:30 Peter Maydell <peter.maydell@linaro.org> ha scritto:
On Thu, 15 Oct 2020 at 21:13, Yonggang Luo <luoyonggang@gmail.com> wrote:
>
> Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
> ---
>  docs/conf.py                  |  2 +-
>  docs/sphinx/kerneldoc.py      |  2 +-
>  scripts/rst-sanitize.py       | 21 +++++++++++++++++++++
>  tests/qapi-schema/meson.build |  5 +++--
>  4 files changed, 26 insertions(+), 4 deletions(-)
>  create mode 100644 scripts/rst-sanitize.py
>
> diff --git a/scripts/rst-sanitize.py b/scripts/rst-sanitize.py
> new file mode 100644
> index 0000000000..26060f1208
> --- /dev/null
> +++ b/scripts/rst-sanitize.py
> @@ -0,0 +1,21 @@
> +#!/usr/bin/env python3
> +
> +#
> +# Script for remove cr line ending in file
> +#
> +# Authors:
> +#  Yonggang Luo <luoyonggang@gmail.com>
> +#
> +# This work is licensed under the terms of the GNU GPL, version 2
> +# or, at your option, any later version.  See the COPYING file in
> +# the top-level directory.
> +
> +import sys
> +
> +def main(_program, file, *unused):
> +    with open(file, 'rb') as content_file:
> +        content = content_file.read()
> +        sys.stdout.buffer.write(content.replace(b'\r', b''))
> +
> +if __name__ == "__main__":
> +    main(*sys.argv)

Why doesn't the perl rune work? Your commit message doesn't say.

Ninjatool gets confused by Windows escapes. So it's a QEMU-ism and switching to ninja fixes it. There's no need to use a separate script for this.

Paolo


> diff --git a/tests/qapi-schema/meson.build b/tests/qapi-schema/meson.build
> index 1f222a7a13..20a7641af8 100644
> --- a/tests/qapi-schema/meson.build
> +++ b/tests/qapi-schema/meson.build
> @@ -251,18 +251,19 @@ qapi_doc_out = custom_target('QAPI rST doc',
>  # using an explicit '\' character in the command arguments to
>  # a custom_target(), as Meson will unhelpfully replace it with a '/'
>  # (https://github.com/mesonbuild/meson/issues/1564)
> +rst_sanitize_cmd = [find_program('../../scripts/rst-sanitize.py'), '@INPUT@']
>  qapi_doc_out_nocr = custom_target('QAPI rST doc newline-sanitized',
>                                    output: ['doc-good.txt.nocr'],
>                                    input: qapi_doc_out[0],
>                                    build_by_default: build_docs,
> -                                  command: ['perl', '-pe', '$x = chr 13; s/$x$//', '@INPUT@'],
> +                                  command: rst_sanitize_cmd,
>                                    capture: true)
>
>  qapi_doc_ref_nocr = custom_target('QAPI rST doc reference newline-sanitized',
>                                    output: ['doc-good.ref.nocr'],
>                                    input: files('doc-good.txt'),
>                                    build_by_default: build_docs,
> -                                  command: ['perl', '-pe', '$x = chr 13; s/$x$//', '@INPUT@'],
> +                                  command: rst_sanitize_cmd,
>                                    capture: true)

thanks
-- PMM


reply via email to

[Prev in Thread] Current Thread [Next in Thread]