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

Fix problem with dummy configuration file on ReadTheDocs #3579

Merged
merged 1 commit into from
Nov 27, 2019

Conversation

sphuber
Copy link
Contributor

@sphuber sphuber commented Nov 26, 2019

Fixes #3578

The recent change in the backup behavior of the configuration file leads
to problems on ReadTheDocs. The dummy config returned by load_config
when on RTD uses /dev/null as dummy filepath, but the new backup
mechanism will try to write a backup using that filepath as a prefix,
leading to a filepath that can't be written to. The temporary fix until
we get rid of this hacky dummy profile concept is to simply use the
default location of the config file.

@sphuber sphuber requested a review from ltalirz November 26, 2019 21:54
@sphuber
Copy link
Contributor Author

sphuber commented Nov 26, 2019

With this fix it seems to build again: https://readthedocs.org/projects/aiida-core/builds/10026000/

if IN_RT_DOC_MODE:
# The following is a dummy config.json configuration that it is used for the
# proper compilation of the documentation on readthedocs.
from aiida.manage.external.postgres import DEFAULT_DBINFO
return Config(
'/dev/null', {
filepath, {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah hm - I wonder: What if now someone sets the environment variable to run in RTD mode on their local laptop. Will this overwrite the existing config file?

Perhaps it would be safer to simply use some temporary file path?
Could we perhaps reuse some of the code from here:

def temporary_config_instance():

Copy link
Contributor Author

@sphuber sphuber Nov 26, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's what I originally was trying as well, but then it is difficult to control the lifetime of it. I will have to create the tempfile in the load_config function, but then cannot control when it should be deleted. This way we will end up with uncleaned temp files. Frankly, I wanted to get rid of these hacks just for RTD for a long time. I remember you also opened an issue recently with a request for some official API to do what we currently do in the docs/source/conf.py for I believe plugins to be able to do the same. I'd rather have this go in now and then fix it properly soon

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, fine not to merge the functionality.
I still think, though, that we should be sure not to overwrite an existing config file (creating a temporary one without deleting it is preferable).

Are we sure your approach does not overwrite an existing config file?

Copy link
Member

@ltalirz ltalirz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the fix!

just one comment

The recent change in the backup behavior of the configuration file leads
to problems on ReadTheDocs. The dummy config returned by `load_config`
when on RTD uses `/dev/null` as dummy filepath, but the new backup
mechanism will try to write a backup using that filepath as a prefix,
leading to a filepath that can't be written to. The temporary fix is to
use an actual temporary file for the dummy filepath.
@sphuber sphuber force-pushed the fix_3578_readthedocs branch from 451b448 to 3d75f9a Compare November 27, 2019 07:29
@sphuber
Copy link
Contributor Author

sphuber commented Nov 27, 2019

@ltalirz OK I replaced it with a real temporary file, but it is not cleaning it up.

@greschd
Copy link
Member

greschd commented Nov 27, 2019

Hacky solution: why not put it in the sphinx BUILDDIR? Then make clean should take care of it.

This probably doesn't matter much if the root issue will be fixed properly soon, though.

Copy link
Member

@ltalirz ltalirz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks @sphuber !

@sphuber sphuber merged commit 80bd663 into develop Nov 27, 2019
@sphuber sphuber deleted the fix_3578_readthedocs branch November 27, 2019 11:05
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

Successfully merging this pull request may close these issues.

documentation build failures
3 participants