Skip to content

Commit

Permalink
add temporary hack to avoid RS services when offline
Browse files Browse the repository at this point in the history
  • Loading branch information
oscarlevin committed Feb 11, 2025
1 parent cf40005 commit e01ea62
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ Instructions: Add a subsection under `[Unreleased]` for additions, fixes, change

## [Unreleased]

### Changed

- Added a temporary hack to avoid build failures when not connected to the internet. This will be reverted in 2.14 in favor of a more robust solution.

## [2.13.1] - 2025-02-11

Includes updates to core through commit: [2f6bfae](https://github.com/PreTeXtBook/pretext/commit/2f6bfaedec237e0024772dd1a7486b5559ec53df)
Expand Down
15 changes: 15 additions & 0 deletions pretext/project/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import tempfile
from pathlib import Path
from functools import partial
import requests

from lxml import etree as ET # noqa: N812

Expand Down Expand Up @@ -637,6 +638,20 @@ def build(
if no_knowls:
self.stringparams["debug.skip-knowls"] = "yes"

# if no internet access, turn off runestone features
# Note: this is temporary code that will be removed once the runestone methods are merged into core pretext.
try:
test_services = requests.get(
"https://runestone.academy/cdn/runestone/latest/webpack_static_imports.xml",
timeout=5,
)
except requests.exceptions.RequestException as e:
log.warning(
"No internet access detected; turning off Runestone features. Your output might not work correctly until you rebuild with internet access."
)
self.stringparams["debug.rs.dev"] = "yes"
# End temporary code

# Proceed with the build
with tempfile.TemporaryDirectory(prefix="ptxcli_") as tmp_xsl_str:
# Put the custom xsl in a "cli_xsl" directory inside the temporary directory, so we can create a symlink to core from the temporary directory itself.
Expand Down
2 changes: 1 addition & 1 deletion pretext/resources/resource_hash_table.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"2.11.5": {"project.ptx": "20b8cd8099dc3b21a04bcf94d9386446f07e7b11eb1bc3247875546a173b0b3c", "codechat_config.yaml": "d1314aefecb11bf4dee0775ba095ad90bd508c2023c8be1a4dc02ed71406afee", ".gitignore": "56a9ffb6b221bea906348ab3ccb4af37a42d89aeeaaff1e8abf46c06217fd05c", ".devcontainer.json": "4a3c939ffe2fdae8670da5254984419107a794013ef0487e2cbc84db465d0371", "pretext-cli.yml": "acc8fa861bba25478048c1d731a0e2057a746dff9542ee007766111886660f8a"}, "2.12.1": {"project.ptx": "d160e345ff6172157517ce95f3310e3a19f8e05779865316f4a02e1fac13329f", "codechat_config.yaml": "8fbb8c5e888da3b49e070dd189195becc104b082f3d3c3dfbd0de0f9652a1c7e", ".gitignore": "348671629432e5a41f11d2b07242a51831858e3aef41d7f3eb435f3175d3afe4", ".devcontainer.json": "7113274fe6b005b742e68381d477cee3376b4bff8f673eade0b6300a88b2a8eb", "pretext-cli.yml": "a01524273301bfb48b1d72ec0c968f51e63f81a299007b2604e53cb53509ff3b"}, "2.13.1": {"project.ptx": "5bc12b1064ad51b1b0fe5eaaf8f117e133032f3e83907b5e4ae54c10f046b2fb", "codechat_config.yaml": "42c25e156024d8387ecea798406c2bbe990cf8b721946f4f4bb23d9f36f99a5c", ".gitignore": "426ad2f18d6cd35428a52d967e3381195ab610527158a839f072dac594e93e2f", ".devcontainer.json": "ab5713855ee14c265989fc3525ac70665edd5b7745803a58b9d3b240df7e5be5", "pretext-cli.yml": "32f8f76fe6894505ef0e84a47d9546f8b6ee6422fcb031cfc1bab242890da0a5"}}
{"2.11.5": {"project.ptx": "20b8cd8099dc3b21a04bcf94d9386446f07e7b11eb1bc3247875546a173b0b3c", "codechat_config.yaml": "d1314aefecb11bf4dee0775ba095ad90bd508c2023c8be1a4dc02ed71406afee", ".gitignore": "56a9ffb6b221bea906348ab3ccb4af37a42d89aeeaaff1e8abf46c06217fd05c", ".devcontainer.json": "4a3c939ffe2fdae8670da5254984419107a794013ef0487e2cbc84db465d0371", "pretext-cli.yml": "acc8fa861bba25478048c1d731a0e2057a746dff9542ee007766111886660f8a"}, "2.12.1": {"project.ptx": "d160e345ff6172157517ce95f3310e3a19f8e05779865316f4a02e1fac13329f", "codechat_config.yaml": "8fbb8c5e888da3b49e070dd189195becc104b082f3d3c3dfbd0de0f9652a1c7e", ".gitignore": "348671629432e5a41f11d2b07242a51831858e3aef41d7f3eb435f3175d3afe4", ".devcontainer.json": "7113274fe6b005b742e68381d477cee3376b4bff8f673eade0b6300a88b2a8eb", "pretext-cli.yml": "a01524273301bfb48b1d72ec0c968f51e63f81a299007b2604e53cb53509ff3b"}, "2.13.1": {"project.ptx": "5bc12b1064ad51b1b0fe5eaaf8f117e133032f3e83907b5e4ae54c10f046b2fb", "codechat_config.yaml": "42c25e156024d8387ecea798406c2bbe990cf8b721946f4f4bb23d9f36f99a5c", ".gitignore": "426ad2f18d6cd35428a52d967e3381195ab610527158a839f072dac594e93e2f", ".devcontainer.json": "ab5713855ee14c265989fc3525ac70665edd5b7745803a58b9d3b240df7e5be5", "pretext-cli.yml": "32f8f76fe6894505ef0e84a47d9546f8b6ee6422fcb031cfc1bab242890da0a5"}, "2.13.2": {"project.ptx": "fc8587b8c1e1cfbfd81795c18f277c7c24e78184d2142dcfd0ecde2df5c4b113", "codechat_config.yaml": "ff403a8eb5044a99fd7d8ab91396e67ba09d5a0ff5baa6b06ae6e0b2e144280e", ".gitignore": "2c2374d6c4c0057c454ccc9bbc0edf8371a92675ef43ec20e10480da6726251f", ".devcontainer.json": "a5ae571e96fafbb67e496f9b1920b1b257179179d173048475b9aa9e4bd97544", "pretext-cli.yml": "fb5dc2394469de88c9c662be8c71b39e600e80378a41f50db36f4405d4bde3fa"}}
2 changes: 1 addition & 1 deletion templates/.devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This file was automatically generated with PreTeXt 2.13.1.
// This file was automatically generated with PreTeXt 2.13.2.
// If you modify this file, PreTeXt will no longer automatically update it.
//
//////////////////////////////////////////////////////////////
Expand Down
2 changes: 1 addition & 1 deletion templates/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This file was automatically generated with PreTeXt 2.13.1.
# This file was automatically generated with PreTeXt 2.13.2.
# If you modify this file, PreTeXt will no longer automatically update it.
#
# Boilerplate list of files in a PreTeXt project for git to ignore
Expand Down
2 changes: 1 addition & 1 deletion templates/codechat_config.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This file was automatically generated with PreTeXt 2.13.1.
# This file was automatically generated with PreTeXt 2.13.2.
# If you modify this file, PreTeXt will no longer automatically update it.
#
#############################################################
Expand Down
2 changes: 1 addition & 1 deletion templates/pretext-cli.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This file was automatically generated with PreTeXt 2.13.1.
# This file was automatically generated with PreTeXt 2.13.2.
# If you modify this file, PreTeXt will no longer automatically update it.
#
name: PreTeXt-CLI Actions
Expand Down
2 changes: 1 addition & 1 deletion templates/project.ptx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- This file was automatically generated by PreTeXt 2.13.1. -->
<!-- This file was automatically generated by PreTeXt 2.13.2. -->
<!-- If you modify this file, PreTeXt will no longer automatically update it.-->

<!-- This file, the project manifest, provides the overall configuration for your PreTeXt project. To edit the content of your document, open `source/main.ptx`. See https://pretextbook.org/doc/guide/html/processing-CLI.html#cli-project-manifest. -->
Expand Down

0 comments on commit e01ea62

Please sign in to comment.