Skip to content

8.1.3: sphinx warnings reference target not found #1974

Open
@kloczek

Description

@kloczek

On building my packages I'm using sphinx-build command with -n switch which shows warmings about missing references. These are not critical issues.

First of all it is not possible now use straight sphinx-build.

+ /usr/bin/sphinx-build -n -T -b man docs/sphinx build/sphinx/man
Running Sphinx v4.5.0

Traceback (most recent call last):
  File "/usr/lib/python3.8/site-packages/sphinx/config.py", line 332, in eval_config_file
    exec(code, namespace)
  File "/home/tkloczko/rpmbuild/BUILD/elasticsearch-py-8.1.3/docs/sphinx/conf.py", line 22, in <module>
    import elasticsearch
ModuleNotFoundError: No module named 'elasticsearch'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/lib/python3.8/site-packages/sphinx/cmd/build.py", line 272, in build_main
    app = Sphinx(args.sourcedir, args.confdir, args.outputdir,
  File "/usr/lib/python3.8/site-packages/sphinx/application.py", line 202, in __init__
    self.config = Config.read(self.confdir, confoverrides or {}, self.tags)
  File "/usr/lib/python3.8/site-packages/sphinx/config.py", line 165, in read
    namespace = eval_config_file(filename, tags)
  File "/usr/lib/python3.8/site-packages/sphinx/config.py", line 345, in eval_config_file
    raise ConfigError(msg % traceback.format_exc()) from exc
sphinx.errors.ConfigError: There is a programmable error in your configuration file:

Traceback (most recent call last):
  File "/usr/lib/python3.8/site-packages/sphinx/config.py", line 332, in eval_config_file
    exec(code, namespace)
  File "/home/tkloczko/rpmbuild/BUILD/elasticsearch-py-8.1.3/docs/sphinx/conf.py", line 22, in <module>
    import elasticsearch
ModuleNotFoundError: No module named 'elasticsearch'


Configuration error:
There is a programmable error in your configuration file:

Traceback (most recent call last):
  File "/usr/lib/python3.8/site-packages/sphinx/config.py", line 332, in eval_config_file
    exec(code, namespace)
  File "/home/tkloczko/rpmbuild/BUILD/elasticsearch-py-8.1.3/docs/sphinx/conf.py", line 22, in <module>
    import elasticsearch
ModuleNotFoundError: No module named 'elasticsearch'

This can be fixed by use approach which is mentioned in sphisnx dosumentation https://www.sphinx-doc.org/en/master/usage/configuration.html#example-of-configuration-file

--- a/docs/sphinx/conf.py~      2022-04-26 19:26:16.000000000 +0000
+++ b/docs/sphinx/conf.py       2022-04-26 19:27:32.708018028 +0000
@@ -18,6 +18,8 @@

 import datetime
 import os
+import sys
+sys.path.insert(0, os.path.abspath('../..'))

 import elasticsearch

With that patch socumemtation will be always generated out os the module code from source tree.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions