Skip to content

Regression in relative vs. absolute path of dependencies #14196

@mgeier

Description

@mgeier

Describe the bug

Since Sphinx 9, a CI failure appeared in my project https://github.com/mgeier/sphinx-last-updated-by-git, see e.g. https://github.com/mgeier/sphinx-last-updated-by-git/actions/runs/20314482086/job/58354292735.

I bisected the problem down to #13681, commit f2bf37d.

I think the problem is here:

# this will do the right thing when *filename* is absolute too
filename = self.srcdir / filename

This line has been added and it turns previously relative dependency paths into absolute paths.

How to Reproduce

Look at dependencies that have previously been relative paths, now they are absolute paths.

For a concrete example, see the instructions in #10692, just using a different source file. Namely, add this to conf.py:

def _env_updated(app, env):
    print(env.dependencies['example_module.example_function'])
    exit()

def setup(app):
    app.connect('env-updated', _env_updated)

With f2bf37d and later, this is shown:

{_StrPath('/home/[...]/test-repo-for-sphinx-last-updated-by-git/example_module.py')}

With 711eb2b and anything before that, it displays:

{_StrPath('example_module.py')}

Environment Information

-

Sphinx extensions

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions