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

1.4.0: not installed jaraco/tidelift/banner.html file #4

Closed
kloczek opened this issue Dec 4, 2021 · 2 comments
Closed

1.4.0: not installed jaraco/tidelift/banner.html file #4

kloczek opened this issue Dec 4, 2021 · 2 comments

Comments

@kloczek
Copy link

kloczek commented Dec 4, 2021

Just found that on generate path module documentation sphinx fails because missing file which seems should be provided by tidelift/issues

+ /usr/bin/python3 setup.py build_sphinx -b man --build-dir build/sphinx
running build_sphinx
Running Sphinx v4.3.1
making output directory... done
loading intersphinx inventory from http://docs.python.org/objects.inv...
intersphinx inventory has moved: http://docs.python.org/objects.inv -> https://docs.python.org/3/objects.inv
building [mo]: targets for 0 po files that are out of date
building [man]: all manpages
updating environment: [new config] 3 added, 0 changed, 0 removed
reading sources... [100%] index
Exception occurred:
  File "/usr/lib64/python3.8/pathlib.py", line 1078, in _opener
    return self._accessor.open(self, flags, mode)
FileNotFoundError: [Errno 2] No such file or directory: '/usr/lib/python3.8/site-packages/jaraco/tidelift/banner.html'
The full traceback has been saved in /tmp/sphinx-err-dttzpp9n.log, if you want to report the issue to the developers.
Please also report this if it was a user error, so that a better error message can be provided next time.
A bug report can be filed in the tracker at <https://github.com/sphinx-doc/sphinx/issues>. Thanks!
@jaraco
Copy link
Owner

jaraco commented Mar 18, 2022

There's something wrong with your installed environment.

To troubleshoot, you should manually try to do what happens here. For example:

$ .tox/python/bin/python -c "import jaraco.tidelift.banner as bn; import importlib_resources as res; print(res.files(bn.__package__).joinpath('banner.html').read_text())"
<div class="tidelift for-enterprise" style="margin: 0 auto; width: 940px;">
...<div>

As you can see, in my environment, jaraco.tidelift is able to load the banner html resource from the package.

I see it also works for jaraco.tidelift as installed using pip:

$ pip-run -q jaraco.tidelift sphinx -- -c "import jaraco.tidelift.banner as bn; import importlib_resources as res; print(res.files(bn.__package__).joinpath('banner.html').read_text())" | head -n 1
<div class="tidelift for-enterprise" style="margin: 0 auto; width: 940px;">

Hope that helps.

@kloczek
Copy link
Author

kloczek commented Apr 22, 2022

Closing.
I'm no longer able to see that issue in latest 1.5.0.

Only one small details still is to resolve.
In mean time Iime moved away from using sphinx<>setuptools integration on generate documentation to straight use spinx-build.
On using that command I see one warning:

[tkloczko@devel-g2v jaraco.tidelift-1.5.0]$ SETUPTOOLS_SCM_PRETEND_VERSION=1.5.0 /usr/bin/sphinx-build -n -T -b man docs build/sphinx/man
Running Sphinx v4.5.0
making output directory... done
loading intersphinx inventory from https://docs.python.org/3/objects.inv...
building [mo]: targets for 0 po files that are out of date
building [man]: all manpages
updating environment: [new config] 2 added, 0 changed, 0 removed
reading sources... [100%] index
WARNING: autodoc: failed to import module 'tidelift' from module 'jaraco'; the following exception was raised:
No module named 'jaraco.tidelift'
looking for now-outdated files... none found
pickling environment... done
checking consistency... done
writing... python-jaraco-tidelift.3 { history } done
build succeeded, 1 warning.

The manual pages are in build/sphinx/man.

This can be fixed by patch like below:

--- a/docs/conf.py~     2022-04-22 01:50:53.000000000 +0000
+++ b/docs/conf.py      2022-04-22 01:51:50.045055143 +0000
@@ -1,6 +1,10 @@
 #!/usr/bin/env python3
 # -*- coding: utf-8 -*-

+import sys
+import os
+sys.path.insert(0, os.path.abspath('..'))
+
 extensions = ['sphinx.ext.autodoc', 'jaraco.packaging.sphinx', 'rst.linker']

 master_doc = "index"

With that patch:

[tkloczko@devel-g2v jaraco.tidelift-1.5.0]$ SETUPTOOLS_SCM_PRETEND_VERSION=1.5.0 /usr/bin/sphinx-build -n -T -b man docs build/sphinx/man
Running Sphinx v4.5.0
loading intersphinx inventory from https://docs.python.org/3/objects.inv...
building [mo]: targets for 0 po files that are out of date
building [man]: all manpages
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
writing... python-jaraco-tidelift.3 { history } done
build succeeded.

The manual pages are in build/sphinx/man.

Such modification is even suggested in template copy.py example https://www.sphinx-doc.org/en/master/usage/configuration.html#example-of-configuration-file

Feel free to close that ticket and commit that change or let me know if you want me to submit it as PR.

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