Re: [PULL 18/22] meson: Move the detection logic for sphinx to meson
On 10/16/20 8:27 AM, 罗勇刚(Yonggang Luo) wrote: On Fri, Oct 16, 2020 at 7:48 PM Paolo Bonzini wrote: Meta-comment. Your quoting style leaves a lot to be desired: -if test "$docs" = "yes" ; then - if has $sphinx_build && test "$sphinx_ok" != "yes"; then -echo "Warning: $sphinx_build exists but it is either too old or uses too old a Python version" >&2 - fi - feature_not_found "docs" "Install a Python 3 version of python-sphinx" -fi Here, your mailer wrapped lines but did not quote the wrapped portion, while... + if not build_docs +warning('@0@ exists but it is either too old or uses too old a Python version'.format(sphinx_build_option)) Here need to be get_option('sphinx_build') ...here you added new content without any newline separator, right after another case of a mailer wrapping a line. It makes it very difficult to decipher which text you are quoting and which text you are adding. You may want to consider using a better mail engine that does not split quoted lines incorrectly, as well as using a blank line both before and after every block of your inline replies, to call more visual attention to what you are adding to the conversation. -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org
[PULL 18/22] meson: Move the detection logic for sphinx to meson
From: Yonggang Luo Signed-off-by: Yonggang Luo Message-Id: <20201015220626.418-4-luoyongg...@gmail.com> Signed-off-by: Paolo Bonzini --- configure | 59 --- docs/meson.build | 46 meson.build | 30 meson_options.txt | 4 4 files changed, 64 insertions(+), 75 deletions(-) diff --git a/configure b/configure index 3edbdd2a24..68f097861d 100755 --- a/configure +++ b/configure @@ -297,7 +297,7 @@ brlapi="" curl="" iconv="auto" curses="auto" -docs="" +docs="auto" fdt="auto" netmap="no" sdl="auto" @@ -820,15 +820,6 @@ do fi done -sphinx_build= -for binary in sphinx-build-3 sphinx-build -do -if has "$binary" -then -sphinx_build=$(command -v "$binary") -break -fi -done # Check for ancillary tools used in testing genisoimage= @@ -1228,9 +1219,9 @@ for opt do ;; --disable-crypto-afalg) crypto_afalg="no" ;; - --disable-docs) docs="no" + --disable-docs) docs="disabled" ;; - --enable-docs) docs="yes" + --enable-docs) docs="enabled" ;; --disable-vhost-net) vhost_net="no" ;; @@ -4419,45 +4410,6 @@ if check_include linux/btrfs.h ; then btrfs=yes fi -# If we're making warnings fatal, apply this to Sphinx runs as well -sphinx_werror="" -if test "$werror" = "yes"; then -sphinx_werror="-W" -fi - -# Check we have a new enough version of sphinx-build -has_sphinx_build() { -# This is a bit awkward but works: create a trivial document and -# try to run it with our configuration file (which enforces a -# version requirement). This will fail if either -# sphinx-build doesn't exist at all or if it is too old. -mkdir -p "$TMPDIR1/sphinx" -touch "$TMPDIR1/sphinx/index.rst" -"$sphinx_build" $sphinx_werror -c "$source_path/docs" \ --b html "$TMPDIR1/sphinx" \ -"$TMPDIR1/sphinx/out" >> config.log 2>&1 -} - -# Check if tools are available to build documentation. -if test "$docs" != "no" ; then - if has_sphinx_build; then -sphinx_ok=yes - else -sphinx_ok=no - fi - if test "$sphinx_ok" = "yes"; then -docs=yes - else -if test "$docs" = "yes" ; then - if has $sphinx_build && test "$sphinx_ok" != "yes"; then -echo "Warning: $sphinx_build exists but it is either too old or uses too old a Python version" >&2 - fi - feature_not_found "docs" "Install a Python 3 version of python-sphinx" -fi -docs=no - fi -fi - # Search for bswap_32 function byteswap_h=no cat > $TMPC << EOF @@ -6093,9 +6045,6 @@ qemu_version=$(head $source_path/VERSION) echo "PKGVERSION=$pkgversion" >>$config_host_mak echo "SRC_PATH=$source_path" >> $config_host_mak echo "TARGET_DIRS=$target_list" >> $config_host_mak -if [ "$docs" = "yes" ] ; then - echo "BUILD_DOCS=yes" >> $config_host_mak -fi if test "$modules" = "yes"; then # $shacmd can generate a hash started with digit, which the compiler doesn't # like as an symbol. So prefix it with an underscore @@ -6784,7 +6733,6 @@ fi echo "ROMS=$roms" >> $config_host_mak echo "MAKE=$make" >> $config_host_mak echo "PYTHON=$python" >> $config_host_mak -echo "SPHINX_BUILD=$sphinx_build" >> $config_host_mak echo "GENISOIMAGE=$genisoimage" >> $config_host_mak echo "MESON=$meson" >> $config_host_mak echo "NINJA=$ninja" >> $config_host_mak @@ -7066,6 +7014,7 @@ NINJA=$ninja $meson setup \ -Dgettext=$gettext -Dxkbcommon=$xkbcommon -Du2f=$u2f \ -Dcapstone=$capstone -Dslirp=$slirp -Dfdt=$fdt \ -Diconv=$iconv -Dcurses=$curses -Dlibudev=$libudev\ +-Ddocs=$docs -Dsphinx_build=$sphinx_build \ $cross_arg \ "$PWD" "$source_path" diff --git a/docs/meson.build b/docs/meson.build index 0340d489ac..8c222f96bb 100644 --- a/docs/meson.build +++ b/docs/meson.build @@ -1,4 +1,50 @@ +if get_option('sphinx_build') == '' + sphinx_build = find_program(['sphinx-build-3', 'sphinx-build'], + required: get_option('docs')) +else + sphinx_build = find_program(get_option('sphinx_build'), + required: get_option('docs')) +endif + +# Check if tools are available to build documentation. +build_docs = false +if sphinx_build.found() + SPHINX_ARGS = [sphinx_build] + # If we're making warnings fatal, apply this to Sphinx runs as well + if get_option('werror') +SPHINX_ARGS += [ '-W' ] + endif + + # This is a bit awkward but works: create a trivial document and + # try to run it with our configuration file (which enforces a + # version requirement). This will fail if sphinx-build is too old. + run_command('mkdir', ['-p', tmpdir / 'sphinx']) + run_command('touch', [tmpdir / 'sphinx/index.rst']) + sphinx_build_test_out = run_command(SPHINX_ARGS + [ +'-c', meson.current_source_dir(), +'-b', 'html', tmpdir / 'sphinx', +tmpdir / 'sphinx/out']) + build_docs = (sphinx_build_test_out.returncode()
Re: [PULL 18/22] meson: Move the detection logic for sphinx to meson
On Fri, Oct 16, 2020 at 7:48 PM Paolo Bonzini wrote: > > From: Yonggang Luo > > Signed-off-by: Yonggang Luo > Message-Id: <20201015220626.418-4-luoyongg...@gmail.com> > Signed-off-by: Paolo Bonzini > --- > configure | 59 --- > docs/meson.build | 46 > meson.build | 30 > meson_options.txt | 4 > 4 files changed, 64 insertions(+), 75 deletions(-) > > diff --git a/configure b/configure > index 3edbdd2a24..68f097861d 100755 > --- a/configure > +++ b/configure > @@ -297,7 +297,7 @@ brlapi="" > curl="" > iconv="auto" > curses="auto" > -docs="" > +docs="auto" > fdt="auto" > netmap="no" > sdl="auto" > @@ -820,15 +820,6 @@ do > fi > done > > -sphinx_build= > -for binary in sphinx-build-3 sphinx-build > -do > -if has "$binary" > -then > -sphinx_build=$(command -v "$binary") > -break > -fi > -done > > # Check for ancillary tools used in testing > genisoimage= > @@ -1228,9 +1219,9 @@ for opt do >;; >--disable-crypto-afalg) crypto_afalg="no" >;; > - --disable-docs) docs="no" > + --disable-docs) docs="disabled" >;; > - --enable-docs) docs="yes" > + --enable-docs) docs="enabled" >;; >--disable-vhost-net) vhost_net="no" >;; > @@ -4419,45 +4410,6 @@ if check_include linux/btrfs.h ; then > btrfs=yes > fi > > -# If we're making warnings fatal, apply this to Sphinx runs as well > -sphinx_werror="" > -if test "$werror" = "yes"; then > -sphinx_werror="-W" > -fi > - > -# Check we have a new enough version of sphinx-build > -has_sphinx_build() { > -# This is a bit awkward but works: create a trivial document and > -# try to run it with our configuration file (which enforces a > -# version requirement). This will fail if either > -# sphinx-build doesn't exist at all or if it is too old. > -mkdir -p "$TMPDIR1/sphinx" > -touch "$TMPDIR1/sphinx/index.rst" > -"$sphinx_build" $sphinx_werror -c "$source_path/docs" \ > --b html "$TMPDIR1/sphinx" \ > -"$TMPDIR1/sphinx/out" >> config.log 2>&1 > -} > - > -# Check if tools are available to build documentation. > -if test "$docs" != "no" ; then > - if has_sphinx_build; then > -sphinx_ok=yes > - else > -sphinx_ok=no > - fi > - if test "$sphinx_ok" = "yes"; then > -docs=yes > - else > -if test "$docs" = "yes" ; then > - if has $sphinx_build && test "$sphinx_ok" != "yes"; then > -echo "Warning: $sphinx_build exists but it is either too old or uses too old a Python version" >&2 > - fi > - feature_not_found "docs" "Install a Python 3 version of python-sphinx" > -fi > -docs=no > - fi > -fi > - > # Search for bswap_32 function > byteswap_h=no > cat > $TMPC << EOF > @@ -6093,9 +6045,6 @@ qemu_version=$(head $source_path/VERSION) > echo "PKGVERSION=$pkgversion" >>$config_host_mak > echo "SRC_PATH=$source_path" >> $config_host_mak > echo "TARGET_DIRS=$target_list" >> $config_host_mak > -if [ "$docs" = "yes" ] ; then > - echo "BUILD_DOCS=yes" >> $config_host_mak > -fi > if test "$modules" = "yes"; then ># $shacmd can generate a hash started with digit, which the compiler doesn't ># like as an symbol. So prefix it with an underscore > @@ -6784,7 +6733,6 @@ fi > echo "ROMS=$roms" >> $config_host_mak > echo "MAKE=$make" >> $config_host_mak > echo "PYTHON=$python" >> $config_host_mak > -echo "SPHINX_BUILD=$sphinx_build" >> $config_host_mak > echo "GENISOIMAGE=$genisoimage" >> $config_host_mak > echo "MESON=$meson" >> $config_host_mak > echo "NINJA=$ninja" >> $config_host_mak > @@ -7066,6 +7014,7 @@ NINJA=$ninja $meson setup \ > -Dgettext=$gettext -Dxkbcommon=$xkbcommon -Du2f=$u2f \ > -Dcapstone=$capstone -Dslirp=$slirp -Dfdt=$fdt \ > -Diconv=$iconv -Dcurses=$curses -Dlibudev=$libudev\ > +-Ddocs=$docs -Dsphinx_build=$sphinx_build \ > $cross_arg \ > "$PWD" "$source_path" > > diff --git a/docs/meson.build b/docs/meson.build > index 0340d489ac..789dca8cc0 100644 > --- a/docs/meson.build > +++ b/docs/meson.build > @@ -1,4 +1,50 @@ > +if get_option('sphinx_build') == '' > + sphinx_build = find_program(['sphinx-build-3', 'sphinx-build'], > + required: get_option('docs')) > +else > + sphinx_build = find_program(get_option('sphinx_build'), > + required: get_option('docs')) > +endif > + > +# Check if tools are available to build documentation. > +build_docs = false > +if sphinx_build.found() > + SPHINX_ARGS = [sphinx_build] > + # If we're making warnings fatal, apply this to Sphinx runs as well > + if get_option('werror') > +SPHINX_ARGS += [ '-W' ] > + endif > + > + # This is a bit awkward but works: create a trivial document and > + # try to run it with our configuration file (which enforces a > + # version requirement). This will fail
[PULL 18/22] meson: Move the detection logic for sphinx to meson
From: Yonggang Luo Signed-off-by: Yonggang Luo Message-Id: <20201015220626.418-4-luoyongg...@gmail.com> Signed-off-by: Paolo Bonzini --- configure | 59 --- docs/meson.build | 46 meson.build | 30 meson_options.txt | 4 4 files changed, 64 insertions(+), 75 deletions(-) diff --git a/configure b/configure index 3edbdd2a24..68f097861d 100755 --- a/configure +++ b/configure @@ -297,7 +297,7 @@ brlapi="" curl="" iconv="auto" curses="auto" -docs="" +docs="auto" fdt="auto" netmap="no" sdl="auto" @@ -820,15 +820,6 @@ do fi done -sphinx_build= -for binary in sphinx-build-3 sphinx-build -do -if has "$binary" -then -sphinx_build=$(command -v "$binary") -break -fi -done # Check for ancillary tools used in testing genisoimage= @@ -1228,9 +1219,9 @@ for opt do ;; --disable-crypto-afalg) crypto_afalg="no" ;; - --disable-docs) docs="no" + --disable-docs) docs="disabled" ;; - --enable-docs) docs="yes" + --enable-docs) docs="enabled" ;; --disable-vhost-net) vhost_net="no" ;; @@ -4419,45 +4410,6 @@ if check_include linux/btrfs.h ; then btrfs=yes fi -# If we're making warnings fatal, apply this to Sphinx runs as well -sphinx_werror="" -if test "$werror" = "yes"; then -sphinx_werror="-W" -fi - -# Check we have a new enough version of sphinx-build -has_sphinx_build() { -# This is a bit awkward but works: create a trivial document and -# try to run it with our configuration file (which enforces a -# version requirement). This will fail if either -# sphinx-build doesn't exist at all or if it is too old. -mkdir -p "$TMPDIR1/sphinx" -touch "$TMPDIR1/sphinx/index.rst" -"$sphinx_build" $sphinx_werror -c "$source_path/docs" \ --b html "$TMPDIR1/sphinx" \ -"$TMPDIR1/sphinx/out" >> config.log 2>&1 -} - -# Check if tools are available to build documentation. -if test "$docs" != "no" ; then - if has_sphinx_build; then -sphinx_ok=yes - else -sphinx_ok=no - fi - if test "$sphinx_ok" = "yes"; then -docs=yes - else -if test "$docs" = "yes" ; then - if has $sphinx_build && test "$sphinx_ok" != "yes"; then -echo "Warning: $sphinx_build exists but it is either too old or uses too old a Python version" >&2 - fi - feature_not_found "docs" "Install a Python 3 version of python-sphinx" -fi -docs=no - fi -fi - # Search for bswap_32 function byteswap_h=no cat > $TMPC << EOF @@ -6093,9 +6045,6 @@ qemu_version=$(head $source_path/VERSION) echo "PKGVERSION=$pkgversion" >>$config_host_mak echo "SRC_PATH=$source_path" >> $config_host_mak echo "TARGET_DIRS=$target_list" >> $config_host_mak -if [ "$docs" = "yes" ] ; then - echo "BUILD_DOCS=yes" >> $config_host_mak -fi if test "$modules" = "yes"; then # $shacmd can generate a hash started with digit, which the compiler doesn't # like as an symbol. So prefix it with an underscore @@ -6784,7 +6733,6 @@ fi echo "ROMS=$roms" >> $config_host_mak echo "MAKE=$make" >> $config_host_mak echo "PYTHON=$python" >> $config_host_mak -echo "SPHINX_BUILD=$sphinx_build" >> $config_host_mak echo "GENISOIMAGE=$genisoimage" >> $config_host_mak echo "MESON=$meson" >> $config_host_mak echo "NINJA=$ninja" >> $config_host_mak @@ -7066,6 +7014,7 @@ NINJA=$ninja $meson setup \ -Dgettext=$gettext -Dxkbcommon=$xkbcommon -Du2f=$u2f \ -Dcapstone=$capstone -Dslirp=$slirp -Dfdt=$fdt \ -Diconv=$iconv -Dcurses=$curses -Dlibudev=$libudev\ +-Ddocs=$docs -Dsphinx_build=$sphinx_build \ $cross_arg \ "$PWD" "$source_path" diff --git a/docs/meson.build b/docs/meson.build index 0340d489ac..789dca8cc0 100644 --- a/docs/meson.build +++ b/docs/meson.build @@ -1,4 +1,50 @@ +if get_option('sphinx_build') == '' + sphinx_build = find_program(['sphinx-build-3', 'sphinx-build'], + required: get_option('docs')) +else + sphinx_build = find_program(get_option('sphinx_build'), + required: get_option('docs')) +endif + +# Check if tools are available to build documentation. +build_docs = false +if sphinx_build.found() + SPHINX_ARGS = [sphinx_build] + # If we're making warnings fatal, apply this to Sphinx runs as well + if get_option('werror') +SPHINX_ARGS += [ '-W' ] + endif + + # This is a bit awkward but works: create a trivial document and + # try to run it with our configuration file (which enforces a + # version requirement). This will fail if sphinx-build is too old. + run_command('mkdir', ['-p', tmpdir / 'sphinx']) + run_command('touch', [tmpdir / 'sphinx/index.rst']) + sphinx_build_test_out = run_command(SPHINX_ARGS + [ +'-c', meson.current_source_dir(), +'-b', 'html', tmpdir / 'sphinx', +tmpdir / 'sphinx/out']) + build_docs = (sphinx_build_test_out.returncode()