Skip to content

Commit 733e8f4

Browse files
authored
Update bundling logic to use latest docker image (#1032)
1 parent 21ca129 commit 733e8f4

File tree

10 files changed

+24
-19
lines changed

10 files changed

+24
-19
lines changed

pretext/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
VERSION = get_version("pretext", Path(__file__).parent.parent)
2020

2121

22-
CORE_COMMIT = "c750a05a2c35cad67dd269682e1618e3c1eb63dc"
22+
CORE_COMMIT = "acd359af3ce3476249f3a81d14dc93f5dd7ae61e"
2323

2424

2525
def activate() -> None:

scripts/bundle_resources.py

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,19 @@
22
import shutil
33
import re
44
import json
5+
import urllib.request
56
from pathlib import Path
67
from pretext import VERSION
78
from pretext.constants import PROJECT_RESOURCES
89

910

1011
def resource_hashes() -> None:
12+
# Get version of the pretext-docker image:
13+
docker_version_url = "https://raw.githubusercontent.com/PreTeXtBook/pretext-docker/refs/heads/main/version.txt"
14+
with urllib.request.urlopen(docker_version_url) as response:
15+
docker_version = response.read().decode().strip()
16+
print(f"pretext-docker version: {docker_version}")
17+
1118
# Load current hash table
1219
if (Path("pretext") / "resources" / "resource_hash_table.json").exists():
1320
with open(Path("pretext") / "resources" / "resource_hash_table.json", "r") as f:
@@ -30,17 +37,15 @@ def resource_hashes() -> None:
3037
for line in lines:
3138
if "This file was automatically generated" in line:
3239
# replace the version number with {VERSION}:
40+
new_line = re.sub(r"PreTeXt {VERSION}", f"PreTeXt {VERSION}", line)
41+
f.write(new_line)
42+
elif '"image": "pretextbook/pretext' in line:
3343
new_line = re.sub(
34-
r"PreTeXt \d+\.\d+\.\d+", f"PreTeXt {VERSION}", line
44+
r'("image": "pretextbook/pretext(-full)?):latest"',
45+
rf'\1:{docker_version}"',
46+
line,
3547
)
3648
f.write(new_line)
37-
# elif '"image": "oscarlevin/pretext' in line:
38-
# new_line = re.sub(
39-
# r'("image": "oscarlevin/pretext(-full)?):latest"',
40-
# rf'\1:{VERSION}"',
41-
# line,
42-
# )
43-
# f.write(new_line)
4449
else:
4550
f.write(line)
4651
# Now hash the updated file to add to a hash-table for this version

templates/.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# This file was automatically generated with PreTeXt 2.19.4.
1+
# This file was automatically generated with PreTeXt {VERSION}.
22
# If you modify this file, PreTeXt will no longer automatically update it.
33
#
44
# Boilerplate list of files in a PreTeXt project for git to ignore

templates/codechat_config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# This file was automatically generated with PreTeXt 2.19.4.
1+
# This file was automatically generated with PreTeXt {VERSION}.
22
# If you modify this file, PreTeXt will no longer automatically update it.
33
#
44
#############################################################

templates/devcontainer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// This file was automatically generated with PreTeXt 2.19.3.
1+
// This file was automatically generated with PreTeXt {VERSION}.
22
// If you modify this file, PreTeXt will no longer automatically update it.
33
//
44
//////////////////////////////////////////////////////////////
@@ -13,9 +13,9 @@
1313
//
1414
///////////////////////////////////////////////////////////////
1515
{
16-
"image": "oscarlevin/pretext-full", // uses latest image from https://hub.docker.com/r/oscarlevin/pretext-full/tags
16+
"image": "pretextbook/pretext-full:latest", // uses latest image from https://hub.docker.com/r/PreTeXtBook/pretext-full/tags
1717
// If you don't need sagemath, you can use a smaller base image. Comment out the line above and uncomment the line below to use a smaller image.
18-
// "image": "oscarlevin/pretext",
18+
// "image": "pretextbook/pretext:latest",
1919
"features": {"ghcr.io/devcontainers/features/github-cli": {}},
2020

2121
// The pretext-full image above includes pretext, prefigure, and enough parts of latex and sagemath for most cases. If there are errors with sage, you can install the full sagemath package through Conda by running ./.devcontainer/installSage.sh, or uncommenting that line and rebuilding the container.

templates/installPandoc.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env bash
22

3-
# This file was automatically generated with PreTeXt 2.19.4.
3+
# This file was automatically generated with PreTeXt {VERSION}.
44
# If you modify this file, PreTeXt will no longer automatically update it.
55

66
wget https://github.com/jgm/pandoc/releases/download/3.6.4/pandoc-3.6.4-1-amd64.deb -O pandoc.deb

templates/installSage.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env bash
22

3-
# This file was automatically generated with PreTeXt 2.19.4.
3+
# This file was automatically generated with PreTeXt {VERSION}.
44
# If you modify this file, PreTeXt will no longer automatically update it.
55

66
# Conda should already be installed in the codespace. We need to add the conda-forge channel

templates/pretext-cli.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# This file was automatically generated with PreTeXt 2.23.1.
1+
# This file was automatically generated with PreTeXt {VERSION}.
22
# If you modify this file, PreTeXt will no longer automatically update it.
33
#
44
# This workflow file can be used to automatically build a project and create

templates/pretext-deploy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# This file was automatically generated with PreTeXt 2.19.4.
1+
# This file was automatically generated with PreTeXt {VERSION}.
22
# If you modify this file, PreTeXt will no longer automatically update it.
33
#
44

templates/project.ptx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<!-- This file was automatically generated by PreTeXt 2.19.4. -->
2+
<!-- This file was automatically generated by PreTeXt {VERSION}. -->
33
<!-- If you modify this file, PreTeXt will no longer automatically update it.-->
44

55
<!-- 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. -->

0 commit comments

Comments
 (0)