Skip to content

Commit ef1957c

Browse files
committed
Ensure we start with a clean log
1 parent 0457cc6 commit ef1957c

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

  • components/rsptx/build_tools

components/rsptx/build_tools/core.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,13 @@ def _build_ptx_book(config, gen, manifest, course, click=click, target="runeston
173173
rs = check_project_ptx(click=click, course=course, target=target)
174174
if not rs:
175175
return {"completed": False, "status": "Bad configuration in project.ptx"}
176+
log_path = (
177+
Path(os.environ.get("BOOK_PATH")) / rs.output_dir / "author_build.log"
178+
)
179+
# ensure we get a clean file for each build
180+
with open(log_path, "w") as olfile:
181+
olfile.write(f"Build started at {datetime.datetime.utcnow()}\n")
182+
olfile.write(f"Target: {target}\n")
176183

177184
logger = logging.getLogger("ptxlogger")
178185
string_io_handler = StringIOHandler()
@@ -185,9 +192,6 @@ def _build_ptx_book(config, gen, manifest, course, click=click, target="runeston
185192
rs.generate_assets(only_changed=False, skip_cache=True)
186193

187194
rs.build() # build the book, generating assets as needed
188-
log_path = (
189-
Path(os.environ.get("BOOK_PATH")) / rs.output_dir / "author_build.log"
190-
)
191195
if not log_path.parent.exists():
192196
log_path.parent.mkdir(parents=True, exist_ok=True)
193197
click.echo(f"Writing log to {log_path}")

0 commit comments

Comments
 (0)