Skip to content

Commit 17c1af3

Browse files
committed
Minor updates
1 parent 067bb4c commit 17c1af3

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

readthedocs/doc_builder/director.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ def build(self):
188188
self.build_epub()
189189

190190
self.run_build_job("post_build")
191-
self.generate_readthedocs_data_javascript()
191+
self.store_readthedocs_build_yaml()
192192

193193
after_build.send(
194194
sender=self.data.version,
@@ -394,7 +394,7 @@ def run_build_commands(self):
394394
# Update the `Version.documentation_type` to match the doctype defined
395395
# by the config file. When using `build.commands` it will be `GENERIC`
396396
self.data.version.documentation_type = self.data.config.doctype
397-
self.generate_readthedocs_data_javascript()
397+
self.store_readthedocs_build_yaml()
398398

399399
def install_build_tools(self):
400400
"""
@@ -629,7 +629,7 @@ def is_type_sphinx(self):
629629
"""Is documentation type Sphinx."""
630630
return "sphinx" in self.data.config.doctype
631631

632-
def generate_readthedocs_data_javascript(self):
632+
def store_readthedocs_build_yaml(self):
633633
# load YAML from user
634634
yaml_path = os.path.join(
635635
self.data.project.artifact_path(
@@ -639,18 +639,20 @@ def generate_readthedocs_data_javascript(self):
639639
)
640640

641641
try:
642-
log.warning(yaml_path)
643-
data = yaml.safe_load(open(yaml_path, "r"))
642+
with open(yaml_path, "r") as f:
643+
data = yaml.safe_load(f)
644644
except Exception:
645-
# NOTE: skip this work for now until we decide whether or not this YAML file is required.
646-
# NOTE: decide whether or not we want this file to be mandatory and raise an exception here.
647-
log.info("No `readthedocs-build.yaml` was provided.")
645+
# NOTE: skip this work for now until we decide whether or not this
646+
# YAML file is required.
647+
#
648+
# NOTE: decide whether or not we want this
649+
# file to be mandatory and raise an exception here.
648650
return
649651

650652
log.info("readthedocs-build.yaml loaded.", path=yaml_path)
651653

652654
# TODO: validate the YAML generated by the user
653-
# self._validate_readthedocs_data_yaml(data)
655+
# self._validate_readthedocs_build_yaml(data)
654656

655657
# Copy the YAML data into `Version.build_data`.
656658
# It will be saved when the API is hit.

0 commit comments

Comments
 (0)