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

Doc builders build from different directories #4

Closed
jaraco opened this issue Feb 9, 2017 · 1 comment
Closed

Doc builders build from different directories #4

jaraco opened this issue Feb 9, 2017 · 1 comment

Comments

@jaraco
Copy link
Owner

jaraco commented Feb 9, 2017

This issue lies more with the larger ecosystem than with rst.linker, but it affects this project.

Since rst.linker takes as input the filenames to be linked, those filenames must be relative to something, either the project root or the cwd. But since these two things are often not the same due to readthedocs/readthedocs.org#890 and the fact that setup.py build_sphinx will typically build from the project root, there's no reliable relative directory from which to reference files.

As a result, rst.linker will fail with an error like

  File "/var/folders/c6/v7hnmq453xb6p2dbz1gqc6rr0000gn/T/rwt-6_7k_t6k/rst/linker.py", line 162, in write_links
    with io.open(source, encoding='utf-8') as source:
FileNotFoundError: [Errno 2] No such file or directory: '../CHANGES.rst'
@jaraco
Copy link
Owner Author

jaraco commented Feb 9, 2017

I've discovered that although the API doesn't seem to expose the project dir nor the docs root, I can access a private attribute which will expose the conf file path, which is suitable for resolving files relative to that file:

(Pdb) app.config._raw_config['__file__']
'/Users/jaraco/Dropbox/code/main/jaraco.timing/docs/conf.py'

@jaraco jaraco closed this as completed in 027d858 Feb 9, 2017
jaraco pushed a commit that referenced this issue Jan 21, 2019
use spaces, fixed indentation, format using autopep8
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

1 participant