Bug 2246942

Summary: python-sphinx-hoverxref fails to build with Sphinx 7.2.6 on Fedora Rawhide (40+)
Product: [Fedora] Fedora Reporter: Karolina Surma <ksurma>
Component: python-sphinx-hoverxrefAssignee: Michel Lind <michel>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: michel
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: python-sphinx-hoverxref-1.3.0-1.fc40 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-12-18 18:18:10 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 2232469, 2244836    

Description Karolina Surma 2023-10-30 08:34:04 UTC
python-sphinx-hoverxref fails to build with Sphinx 7.2.6 on Fedora Rawhide (40+).

The issue detected:
```
__________________ test_override_translator_non_html_builder ___________________

app = <SphinxTestApp buildername='html'>
status = <_io.StringIO object at 0x7f3e3fcbb100>
warning = <_io.StringIO object at 0x7f3e3fcbb940>

    @pytest.mark.sphinx(
        srcdir=srcdir,
        buildername='html',
        confoverrides={
            'hoverxref_project': 'myproject',
            'hoverxref_version': 'myversion',
        },
    )
    def test_override_translator_non_html_builder(app, status, warning):
>       app.build()

tests/test_internals.py:40: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/usr/lib/python3.12/site-packages/sphinx/testing/util.py:147: in build
    super().build(force_all, filenames)
/usr/lib/python3.12/site-packages/sphinx/application.py:355: in build
    self.builder.build_update()
/usr/lib/python3.12/site-packages/sphinx/builders/__init__.py:293: in build_update
    self.build(to_build,
/usr/lib/python3.12/site-packages/sphinx/builders/__init__.py:363: in build
    self.write(docnames, list(updated_docnames), method)
/usr/lib/python3.12/site-packages/sphinx/builders/__init__.py:571: in write
    self._write_serial(sorted(docnames))
/usr/lib/python3.12/site-packages/sphinx/builders/__init__.py:578: in _write_serial
    doctree = self.env.get_and_resolve_doctree(docname, self)
/usr/lib/python3.12/site-packages/sphinx/environment/__init__.py:635: in get_and_resolve_doctree
    self.apply_post_transforms(doctree, docname)
/usr/lib/python3.12/site-packages/sphinx/environment/__init__.py:688: in apply_post_transforms
    transformer.apply_transforms()
/usr/lib/python3.12/site-packages/sphinx/transforms/__init__.py:83: in apply_transforms
    super().apply_transforms()
/usr/lib/python3.12/site-packages/docutils/transforms/__init__.py:182: in apply_transforms
    transform.apply(**kwargs)
/usr/lib/python3.12/site-packages/sphinx/transforms/post_transforms/__init__.py:41: in apply
    self.run(**kwargs)
/usr/lib/python3.12/site-packages/sphinx/transforms/post_transforms/__init__.py:90: in run
    newnode = domain.resolve_xref(self.env, refdoc, self.app.builder,
hoverxref/domains.py:120: in resolve_xref
    return resolver(env, fromdocname, builder, typ, target, node, contnode)
hoverxref/domains.py:139: in _resolve_ref_xref
    docpath = self._get_docpath(builder, docname)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <types.HoverXRefStandardDomain object at 0x7f3e3fe7afc0>
builder = <sphinx.builders.html.StandaloneHTMLBuilder object at 0x7f3e3fe7baa0>
docname = 'chapter-i'

    def _get_docpath(self, builder, docname):
        docpath = builder.get_outfilename(docname)
>       docpath = docpath.replace(builder.outdir, '')
E       TypeError: replace() argument 1 must be str, not _StrPath

hoverxref/domains.py:51: TypeError
--------------------------- Captured stdout teardown ---------------------------
# testroot: root
# builder: html
# srcdir: /builddir/build/BUILD/sphinx-hoverxref-0.5b1/tests/examples/default
# outdir: /builddir/build/BUILD/sphinx-hoverxref-0.5b1/tests/examples/default/_build/html
# status: 
Running Sphinx v7.2.6
building [mo]: targets for 0 po files that are out of date
writing output... 
building [html]: targets for 2 source files that are out of date
updating environment: [new config] 2 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
copying assets... copying static files... done
copying extra files... done
done
writing output... [100%] index
# warning: 

=========================== short test summary info ============================
FAILED tests/test_htmltag.py::test_project_version_settings - TypeError: repl...
FAILED tests/test_htmltag.py::test_js_render - TypeError: replace() argument ...
FAILED tests/test_htmltag.py::test_autosectionlabel_project_version_settings
FAILED tests/test_htmltag.py::test_custom_object - TypeError: replace() argum...
FAILED tests/test_htmltag.py::test_python_domain - TypeError: replace() argum...
FAILED tests/test_htmltag.py::test_default_type - TypeError: replace() argume...
FAILED tests/test_internals.py::test_override_translator_non_html_builder - T...
========================= 7 failed, 4 passed in 1.42s ==========================
```

Sphinx 7.2.x has changed a lot in working with paths. See changelog: https://www.sphinx-doc.org/en/master/changes.html

For the logs from testing build attempts, see:
https://copr.fedorainfracloud.org/coprs/ksurma/sphinx-7.2.6/package/python-sphinx-hoverxref

You can test you package in mock running:

$ mock -r fedora-rawhide-x86_64 --addrepo=https://download.copr.fedorainfracloud.org/results/ksurma/sphinx-7.2.6/fedora-rawhide-x86_64/ --no-clean your.src.rpm
$ mock -r fedora-rawhide-x86_64 --addrepo=https://download.copr.fedorainfracloud.org/results/ksurma/sphinx-7.2.6/fedora-rawhide-x86_64/ shell

We'd like to include Sphinx 7.2.x in Fedora 40.

Let us know here if you have any questions. Thank You!

Comment 1 Karolina Surma 2023-11-02 11:05:35 UTC
The latest upstream version is 1.3.0. I have not tested it but the last failing bit 

hoverxref/domains.py:139: in _resolve_ref_xref
    docpath = self._get_docpath(builder, docname)

is not present there. Maybe updating would be a way to unblock this?

Comment 2 Fedora Update System 2023-12-18 18:16:19 UTC
FEDORA-2023-b86ff58a0d has been submitted as an update to Fedora 40. https://bodhi.fedoraproject.org/updates/FEDORA-2023-b86ff58a0d

Comment 3 Fedora Update System 2023-12-18 18:18:10 UTC
FEDORA-2023-b86ff58a0d has been pushed to the Fedora 40 stable repository.
If problem still persists, please make note of it in this bug report.