OpenNTI / sphinxcontrib-programoutput

Sphinx extension for capturing program output
BSD 3-Clause "New" or "Revised" License
37 stars 17 forks source link

0.17: sphins 4.1.1 warnings #56

Closed kloczek closed 1 month ago

kloczek commented 2 years ago

Looks like python executable name is hardcoded doc/index.rst

+ /usr/bin/python3 setup.py build_sphinx -b man --build-dir build/sphinx
running build_sphinx
Running Sphinx v4.1.1
making output directory... done
loading intersphinx inventory from https://docs.python.org/objects.inv...
loading intersphinx inventory from http://packages.python.org/sphinxcontrib-ansi/objects.inv...
intersphinx inventory has moved: https://docs.python.org/objects.inv -> https://docs.python.org/3/objects.inv
intersphinx inventory has moved: http://packages.python.org/sphinxcontrib-ansi/objects.inv -> https://pythonhosted.org/sphinxcontrib-ansi/objects.inv
building [mo]: targets for 0 po files that are out of date
building [man]: all manpages
updating environment: [new config] 1 added, 0 changed, 0 removed
reading sources... [100%] index
/home/tkloczko/rpmbuild/BUILD/sphinxcontrib-programoutput-0.17/doc/index.rst:44: WARNING: Command ['python', '-V'] failed: [Errno 2] No such file or directory: 'python'
/home/tkloczko/rpmbuild/BUILD/sphinxcontrib-programoutput-0.17/doc/index.rst:79: WARNING: Command ['python', '--help'] failed: [Errno 2] No such file or directory: 'python'
/home/tkloczko/rpmbuild/BUILD/sphinxcontrib-programoutput-0.17/doc/index.rst:94: WARNING: Command ['python', '--help'] failed: [Errno 2] No such file or directory: 'python'
/home/tkloczko/rpmbuild/BUILD/sphinxcontrib-programoutput-0.17/doc/index.rst:106: WARNING: Command ['python', '-V'] failed: [Errno 2] No such file or directory: 'python'
/home/tkloczko/rpmbuild/BUILD/sphinxcontrib-programoutput-0.17/doc/index.rst:116: WARNING: Command ['python', '--help'] failed: [Errno 2] No such file or directory: 'python'
/home/tkloczko/rpmbuild/BUILD/sphinxcontrib-programoutput-0.17/doc/index.rst:250: WARNING: Command ['python', '-V'] failed: [Errno 2] No such file or directory: 'python'
looking for now-outdated files... none found
pickling environment... done
checking consistency... done
writing... python-sphinxcontrib-programoutput.3 { } done
build succeeded, 6 warnings.
jamadden commented 2 years ago

Yes, that's true. The documentation uses this directive, which requires specifying a program to run. In addition to python, there are also examples that require other system-specific tools, such as the Unix-like shell and the echo command. In short, the documentation itself is not, and is not currently intended to be, 100% portable.

That said, I strongly recommend running the documentation in an isolated virtual environment. In addition to all the other advantages, virtual environments (at least on Unix) always include a python executable.

$ cd /tmp
$ clone NextThought/sphinxcontrib-programoutput
Cloning into 'sphinxcontrib-programoutput'...
remote: Enumerating objects: 539, done.
remote: Counting objects: 100% (54/54), done.
remote: Compressing objects: 100% (34/34), done.
remote: Total 539 (delta 16), reused 43 (delta 13), pack-reused 485
Receiving objects: 100% (539/539), 149.24 KiB | 1.57 MiB/s, done.
Resolving deltas: 100% (239/239), done.
$ cd ./sphinxcontrib-programoutput/
$ python3.9 -mvenv ./venv
$ ./bin/activate
$ which python
/private/tmp/sphinxcontrib-programoutput/venv/bin/python
$ pip install .
...
Processing /private/tmp/sphinxcontrib-programoutput
...
$ python -m sphinx -b html -d doc/_build/doctrees doc doc/_build/html
Running Sphinx v4.1.2
making output directory... done
/private/tmp/sphinxcontrib-programoutput/venv/lib/python3.9/site-packages/sphinx/ext/extlinks.py:59: RemovedInSphinx60Warning: extlinks: Sphinx-6.0 will require a caption string to contain exactly one '%s' and all other '%' need to be escaped as '%%'.
  warnings.warn('extlinks: Sphinx-6.0 will require a caption string to '
loading intersphinx inventory from https://docs.python.org/objects.inv...
loading intersphinx inventory from http://packages.python.org/sphinxcontrib-ansi/objects.inv...
intersphinx inventory has moved: https://docs.python.org/objects.inv -> https://docs.python.org/3/objects.inv
intersphinx inventory has moved: http://packages.python.org/sphinxcontrib-ansi/objects.inv -> https://pythonhosted.org/sphinxcontrib-ansi/objects.inv
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 1 source files that are out of date
updating environment: [new config] 1 added, 0 changed, 0 removed
reading sources... [100%] index
looking for now-outdated files... none found
pickling environment... done
checking consistency... done
preparing documents... done
writing output... [100%] index
generating indices... genindex py-modindex done
writing additional pages... search done
copying static files... done
copying extra files... done
dumping search index in English (code: en)... done
dumping object inventory... done
build succeeded.

The HTML pages are in doc/_build/html.
kloczek commented 2 years ago

I've made quick patch for my build env but I have no idea how to generally fix that :/

--- a/doc/index.rst~    2021-03-31 15:59:48.000000000 +0100
+++ b/doc/index.rst     2021-08-01 23:05:32.234801445 +0100
@@ -41,7 +41,7 @@
 inserted into the current document, formatted as literal text without any
 syntax highlighting:

-.. program-output:: python -V
+.. program-output:: python3 -V

 You can omit the content of the standard error stream with the ``nostderr``
 option.
@@ -76,7 +76,7 @@

 The above omits all lines after the second one:

-.. program-output:: python --help
+.. program-output:: python3 --help
    :ellipsis: 2

 Negative numbers count from the last line backwards, thus replacing ``2`` with
@@ -91,7 +91,7 @@

 The above omits all lines except the first two and the last two lines:

-.. program-output:: python --help
+.. program-output:: python3 --help
    :ellipsis: 2,-2

@@ -103,7 +103,7 @@

    .. command-output:: python -V

-.. command-output:: python -V
+.. command-output:: python3 -V

 The appearance of this output can be configured with
 :confval:`programoutput_prompt_template`.  When used in conjunction with
@@ -113,7 +113,7 @@
    .. command-output:: python --help
       :ellipsis: 2

-.. command-output:: python --help
+.. command-output:: python3 --help
    :ellipsis: 2

@@ -247,7 +247,7 @@
    :dir:`command-output`.  Defaults to ``$ {command}\n{output}`` which renders
    as follows:

-   .. command-output:: python -V
+   .. command-output:: python3 -V

    The following keys are provided to the format string:
kloczek commented 1 month ago

Closing. This ricked is outdated.