-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Build: use environment variable $READTHEDOCS_OUTPUT
to define output directory
#9913
Conversation
I played around with this a little bit, and it looks like everything is set properly on docker... just need to figure out how to make it expand it. 🙃 |
Meh, because this PR was based in another PR that now is "Squashed & Merged" we have a bunch of individual commits in this one. We should rebase it to make it consistent now 😞 |
`READTHEDOCS_OUTPUT` points to the path where the user's repository was clonned plus `_readthedocs/` subdirectory. This way we can make the command nicer: ``` python -m sphinx -T -E -j auto -b singlehtml -d _build/doctrees -D language=en . $READTHEDOCS_OUTPUT/html ``` Also, we gives our users a clear contract to where to find those files, even if we change the path of the underlying variable in the future.
2246320
to
382d332
Compare
I merge |
…mitos/output-variable
Add a simple hack to avoid escaping this internal variable since we need it to determine the output path.
I found why the variable was not working properly and I fixed it in 300d303 We need to discuss how to do it correctly to avoid that hack that I put there temporary to show the concept. |
Heh -- that is definitely a hack! Thanks for figuring that out, I really couldn't understand what was happening, but that makes sense. Not 100% sure the best option here. I actually do think there's some useful cases for using env vars in the build commands. I wish we had a comment explaining why we added the escaping. I'm guessing just to be extra careful when allowing users to start modifying build commands. |
I think that "build.jobs" and "build.commands" go over a different workflow because they support environment variables. I think we added this to protect ourselves, maybe? I don't remember. However, we can simply use "escape=False" argument for these 2 commands |
Yeap, we are using readthedocs.org/readthedocs/doc_builder/director.py Lines 332 to 333 in 0c0d2c6
|
$READTHEDOCS_OUTPUT
to define output directory
I found why we need the I noted that I want to avoid escaping another environment variable from ourselves (in #9971), so I may use this hack for now 😄 |
It could contain some private data.
There are some commands that are executed from inside the container where `$READTHEDOCS_OUTPUT` variable is defined and we can use it. However, there are other commands executed from the host where that variable is not defined and/or it cannot be used (e.g. as a `cwd=` argument for Docker run command).
…mitos/output-variable
@ericholscher this is ready for another round of review 👍🏼 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This feels really close. I mainly just have a question on the output dir variables.
…mitos/output-variable
Use `absolute_container_output_dir` and `absolute_host_output_dir` to differentiate them in a clear way.
@ericholscher please, take a final look and let me know if this is ready to merge and deploy tomorrow 👍🏼 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚢
READTHEDOCS_OUTPUT
points to the path where the user's repository was cloned plus_readthedocs/
subdirectory. This way we can make the command nicer:Also, we gives our users a clear contract to where to find those files, even if we change the path of the underlying variable in the future.
This PR is a continuation of #9888. I split it into a different PR because I'm having problems to make the Sphinx command resolving the variable into its real value. The output folders are being saved into
$READTHEDOCS_OUTPUT
being that string the name of the folder 🤦🏼 . We need to research/debug a little more how to make this work properly.