Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs Don't Build Outside of a Git Checkout #162

Open
damaestro opened this issue Nov 14, 2024 · 2 comments
Open

Docs Don't Build Outside of a Git Checkout #162

damaestro opened this issue Nov 14, 2024 · 2 comments

Comments

@damaestro
Copy link

When downloading a repo archive or the source from PyPI, the docs wont build due to not being able to run git commands.

+ PYTHONPATH=src
+ sphinx-build docs html
Running Sphinx v7.3.7

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

Traceback (most recent call last):
  File "/usr/lib/python3.13/site-packages/sphinx/config.py", line 509, in eval_config_file
    exec(code, namespace)  # NoQA: S102
    ~~~~^^^^^^^^^^^^^^^^^
  File "/builddir/build/BUILD/python-Automat-24.8.1-build/automat-24.8.1/docs/conf.py", line 47, in <module>
    _git_reference = subprocess.run(
                     ~~~~~~~~~~~~~~^
        ["git", "rev-parse", "--abbrev-ref", "HEAD"],
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<3 lines>...
        check=True,
        ^^^^^^^^^^^
    ).stdout
    ^
  File "/usr/lib64/python3.13/subprocess.py", line 577, in run
    raise CalledProcessError(retcode, process.args,
                             output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['git', 'rev-parse', '--abbrev-ref', 'HEAD']' returned non-zero exit status 128.
@glyph
Copy link
Owner

glyph commented Nov 14, 2024

The docs are attempting to build their own viewsource URL that corresponds to the place that the code is coming from. It seems to me that the right way to do this for a source checkout is to interrogate the version that the source claims to be respresenting, then compute a viewsource URL derived from the named tag it should correspond to.

Alternately, move all git command executions onto the path where they will actually be used, i.e. ensure that we do not invoke them at all on the READTHEDOCS_VERSION code path, then builders can use that?

I am open to other suggestions.

@damaestro
Copy link
Author

An option to be able to pass in the tag/version would also be fine. That's basically what I've done manually in a downstream patch. If we could just pass the package version to the sphinx-build command and then the git commands are not attempted that would work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants