Skip to content

Commit 3b1c99d

Browse files
authored
Merge branch 'develop' into pr/tobiasdiez/36524
2 parents 49dc635 + d1f99d1 commit 3b1c99d

File tree

3,572 files changed

+101103
-102356
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

3,572 files changed

+101103
-102356
lines changed

.ci/create-changes-html.sh

+50-28
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
#!/bin/sh
22
if [ $# != 2 ]; then
3-
echo >&2 "usage: $0 BASE_DOC_COMMIT DOC_REPO"
4-
echo >&2 "creates CHANGES.html in the current directory"
5-
echo >&2 "for the diffs of DOC_REPO against BASE_DOC_COMMIT"
3+
echo >&2 "Usage: $0 DIFF_TEXT DOC_REPO"
4+
echo >&2 "This script generates a CHANGES.html file in the current directory"
5+
echo >&2 "and adds anchor targets in the documents within DOC_REPO"
6+
echo >&2 "based on the diff hunks in the DIFF_TEXT file."
67
exit 1
78
fi
8-
BASE_DOC_COMMIT="$1"
9+
DIFF_TEXT="$1"
910
DOC_REPOSITORY="$2"
1011

11-
# Wipe out chronic diffs between old doc and new doc
12-
(cd $DOC_REPOSITORY && find . -name "*.html" | xargs sed -i -e '\;<script type="application/vnd\.jupyter\.widget-state+json">;,\;</script>; d')
1312
# Create CHANGES.html
1413
echo '<html>' > CHANGES.html
1514
echo '<head>' >> CHANGES.html
@@ -19,79 +18,102 @@ echo '<script>hljs.highlightAll();</script>' >> CHANGES.html
1918
cat >> CHANGES.html << EOF
2019
<script>
2120
document.addEventListener('DOMContentLoaded', () => {
22-
const baseDocURL = 'https://sagemath.netlify.app'
21+
// This URL is hardcoded in the file .github/workflows/doc-publish.yml.
22+
// See NETLIFY_ALIAS of the "Deploy to Netlify" step.
23+
const baseDocURL = 'https://doc-develop--sagemath.netlify.app'
2324
const diffSite = 'https://pianomister.github.io/diffsite'
2425
const diffParagraphs = document.querySelectorAll('p.diff');
2526
diffParagraphs.forEach(paragraph => {
2627
const rootURL = window.location.origin;
27-
const docAnchor = paragraph.querySelector('a'); // first "a" element
28+
const docAnchor = paragraph.querySelector('a');
2829
const url = new URL(docAnchor.href);
2930
const path = url.pathname;
3031
const anchor = document.createElement('a');
3132
anchor.href = diffSite + '/?url1=' + rootURL + path + '&url2=' + baseDocURL + path;
3233
anchor.textContent = 'compare with the base';
3334
anchor.setAttribute('target', '_blank');
35+
paragraph.innerHTML += '&nbsp;&nbsp;';
3436
paragraph.appendChild(anchor);
35-
paragraph.innerHTML += '&nbsp;';
36-
const hunkAnchors = paragraph.querySelectorAll('a.hunk');
37-
hunkAnchors.forEach(hunkAnchor => {
37+
const hunks = paragraph.parentNode.querySelectorAll('p.hunk');
38+
hunks.forEach(hunk => {
39+
const hunkAnchor = hunk.querySelector('a');
3840
const url = new URL(hunkAnchor.href);
3941
const path = url.pathname;
4042
const pathHash = path + url.hash.replace('#', '%23');
4143
const anchor = document.createElement('a');
4244
anchor.href = diffSite + '/?url1=' + rootURL + pathHash + '&url2=' + baseDocURL + path;
43-
anchor.textContent = hunkAnchor.textContent;
45+
anchor.textContent = 'compare with the base';
4446
anchor.setAttribute('target', '_blank');
45-
paragraph.appendChild(anchor);
46-
paragraph.innerHTML += '&nbsp;';
47+
hunk.innerHTML += '&nbsp;&nbsp;';
48+
hunk.appendChild(anchor);
4749
});
4850
});
4951
});
5052
</script>
5153
EOF
5254
echo '</head>' >> CHANGES.html
5355
echo '<body>' >> CHANGES.html
54-
(cd $DOC_REPOSITORY && git diff $BASE_DOC_COMMIT -- "*.html") > diff.txt
5556
python3 - << EOF
5657
import os, re, html
57-
with open('diff.txt', 'r') as f:
58+
from itertools import chain
59+
with open('$DIFF_TEXT', 'r') as f:
5860
diff_text = f.read()
5961
diff_blocks = re.split(r'^(?=diff --git)', diff_text, flags=re.MULTILINE)
6062
out_blocks = []
6163
for block in diff_blocks:
6264
match = re.search(r'^diff --git a/(.*) b/\1', block, flags=re.MULTILINE)
6365
if match:
64-
doc = match.group(1)
65-
file_path = os.path.join('$DOC_REPOSITORY', doc)
66+
path = match.group(1)
67+
file_path = os.path.join('$DOC_REPOSITORY', path)
6668
try:
6769
with open(file_path, 'r') as file:
6870
content = file.readlines()
6971
except FileNotFoundError:
7072
content = []
7173
count = 0
74+
hunks = []
75+
hunk_lines = []
76+
in_hunk = False
7277
for line in block.splitlines():
7378
if line.startswith('@@ -'):
79+
if hunk_lines:
80+
hunks.append('<pre><code class="language-diff">'
81+
+ html.escape('\n'.join(hunk_lines)).strip()
82+
+ '</code></pre>')
83+
hunk_lines = []
7484
search_result = re.search(r'@@ -(\d+),(\d+) \+(\d+),(\d+)', line)
7585
if search_result:
76-
line_number = int(search_result.group(3))
77-
for i in range(line_number - 1, -1, -1):
78-
if content[i].startswith('<'):
86+
line_number = int(search_result.group(3)) - 1
87+
span = int(search_result.group(4))
88+
for i in chain(range(line_number, line_number + span), range(line_number - 1, -1, -1)):
89+
try:
90+
ln = content[i]
91+
except IndexError:
92+
continue
93+
for idx, char in enumerate(ln):
94+
if not char.isspace():
95+
break
96+
else:
97+
idx = len(ln)
98+
if ln.startswith('<', idx) and not ln.startswith('</', idx):
7999
count += 1
80-
content[i] = f'<span id="hunk{count}" style="visibility: hidden;"></span>' + content[i]
100+
content[i] = ln[:idx] + f'<span id="hunk{count}" style="visibility: hidden;"></span>' + ln[idx:]
101+
hunks.append(f'<p class="hunk"><a href="{path}#hunk{count}" class="hunk" target="_blank">hunk #{count}</a></p>')
81102
break
103+
hunk_lines.append(line)
104+
if hunk_lines:
105+
hunks.append('<pre><code class="language-diff">'
106+
+ html.escape('\n'.join(hunk_lines)).strip()
107+
+ '</code></pre>')
82108
if content:
83109
with open(file_path, 'w') as file:
84110
file.writelines(content)
85-
path = doc
86-
hunks = '&nbsp;'.join(f'<a href="{path}#hunk{i+1}" class="hunk" target="_blank">#{i + 1}</a>' for i in range(count))
87-
out_blocks.append(f'<p class="diff"><a href="{path}">{doc}</a>&nbsp;' + hunks + '&emsp;</p>'
88-
+ '\n<pre><code class="language-diff">'
89-
+ html.escape(block).strip() + '</code></pre>')
111+
out_blocks.append(f'<div class="diff"><p class="diff"><a href="{path}">{path}</a></p>\n' + '\n'.join(hunks) + '\n</div>')
90112
output_text = '\n'.join(out_blocks)
91113
with open('diff.html', 'w') as f:
92114
f.write(output_text)
93115
EOF
94116
cat diff.html >> CHANGES.html
95117
echo '</body>' >> CHANGES.html
96118
echo '</html>' >> CHANGES.html
97-
rm diff.txt diff.html
119+
rm diff.html

.ci/retrofit-worktree.sh

+3-2
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,10 @@ set -x
2323
# If actions/checkout downloaded our source tree using the GitHub REST API
2424
# instead of with git (because do not have git installed in our image),
2525
# we first make the source tree a repo.
26-
if [ ! -d .git ]; then git init && git add -A && git commit --quiet -m "new"; fi
26+
if [ ! -d .git ]; then git init; fi
2727

28-
# Tag this state of the source tree "new". This is what we want to build and test.
28+
# Commit and tag this state of the source tree "new". This is what we want to build and test.
29+
git add -A && git commit --quiet --allow-empty -m "new"
2930
git tag -f new
3031

3132
# Our container image contains a source tree in $WORKTREE_DIRECTORY with a full build of Sage.

.ci/write-dockerfile.sh

+19-12
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ ADD="ADD $__CHOWN"
5555
RUN=RUN
5656
cat <<EOF
5757
ARG BASE_IMAGE=$(eval echo "${FULL_BASE_IMAGE_AND_TAG}")
58-
FROM \${BASE_IMAGE} as with-system-packages
58+
FROM \${BASE_IMAGE} AS with-system-packages
5959
EOF
6060
case $SYSTEM in
6161
debian*|ubuntu*)
@@ -199,7 +199,7 @@ EOF
199199
*)
200200
cat <<EOF
201201
ARG BASE_IMAGE
202-
FROM \${BASE_IMAGE} as with-system-packages
202+
FROM \${BASE_IMAGE} AS with-system-packages
203203
EOF
204204
INSTALL=$(sage-print-system-package-command $SYSTEM install " ")
205205
;;
@@ -260,10 +260,17 @@ case ${DOCKER_BUILDKIT-0} in
260260
CHECK_STATUS_THEN='STATUS=$(cat STATUS 2>/dev/null); case "$STATUS" in ""|0) ;; *) exit $STATUS;; esac; '
261261
esac
262262

263+
if [ -n "$GITHUB_ACTIONS" ]; then
264+
cat <<EOF
265+
ENV GITHUB_ACTIONS=1
266+
EOF
267+
fi
268+
263269
cat <<EOF
264270
265-
FROM with-system-packages as bootstrapped
271+
FROM with-system-packages AS bootstrapped
266272
#:bootstrapping:
273+
RUN rm -rf /new /sage/.git
267274
$ADD Makefile VERSION.txt COPYING.txt condarc.yml README.md bootstrap bootstrap-conda configure.ac sage .homebrew-build-env tox.ini Pipfile.m4 .gitignore /new/
268275
$ADD config/config.rpath /new/config/config.rpath
269276
$ADD src/doc/bootstrap /new/src/doc/bootstrap
@@ -276,8 +283,8 @@ $ADD .upstream.d /new/.upstream.d
276283
ADD .ci /.ci
277284
RUN if [ -d /sage ]; then \
278285
echo "### Incremental build from \$(cat /sage/VERSION.txt)" && \
279-
printf '/src\n!/src/doc/bootstrap\n!/src/bin\n!/src/*.m4\n!/src/*.toml\n!/src/VERSION.txt\n' >> /sage/.gitignore && \
280-
printf '/src\n!/src/doc/bootstrap\n!/src/bin\n!/src/*.m4\n!/src/*.toml\n!/src/VERSION.txt\n' >> /new/.gitignore && \
286+
printf '/src/*\n!/src/doc/bootstrap\n!/src/bin\n!/src/*.m4\n!/src/*.toml\n!/src/VERSION.txt\n' >> /sage/.gitignore && \
287+
printf '/src/*\n!/src/doc/bootstrap\n!/src/bin\n!/src/*.m4\n!/src/*.toml\n!/src/VERSION.txt\n' >> /new/.gitignore && \
281288
if ! (cd /new && /.ci/retrofit-worktree.sh worktree-image /sage); then \
282289
echo "retrofit-worktree.sh failed, falling back to replacing /sage"; \
283290
for a in local logs; do \
@@ -294,7 +301,7 @@ WORKDIR /sage
294301
ARG BOOTSTRAP="${BOOTSTRAP-./bootstrap}"
295302
$RUN sh -x -c "\${BOOTSTRAP}" $ENDRUN $THEN_SAVE_STATUS
296303
297-
FROM bootstrapped as configured
304+
FROM bootstrapped AS configured
298305
#:configuring:
299306
RUN $CHECK_STATUS_THEN mkdir -p logs/pkgs; rm -f config.log; ln -s logs/pkgs/config.log config.log
300307
ARG CONFIGURE_ARGS="${CONFIGURE_ARGS:---enable-build-as-root}"
@@ -310,7 +317,7 @@ EOF
310317
fi
311318
cat <<EOF
312319
313-
FROM configured as with-base-toolchain
320+
FROM configured AS with-base-toolchain
314321
# We first compile base-toolchain because otherwise lots of packages are missing their dependency on 'patch'
315322
ARG NUMPROC=8
316323
ENV MAKE="make -j\${NUMPROC}"
@@ -320,7 +327,7 @@ ENV SAGE_CHECK_PACKAGES="!cython,!r,!python3,!gap,!cysignals,!linbox,!git,!ppl,!
320327
#:toolchain:
321328
$RUN $CHECK_STATUS_THEN make \${USE_MAKEFLAGS} base-toolchain $ENDRUN $THEN_SAVE_STATUS
322329
323-
FROM with-base-toolchain as with-targets-pre
330+
FROM with-base-toolchain AS with-targets-pre
324331
ARG NUMPROC=8
325332
ENV MAKE="make -j\${NUMPROC}"
326333
ARG USE_MAKEFLAGS="-k V=0"
@@ -330,15 +337,14 @@ ENV SAGE_CHECK_PACKAGES="!cython,!r,!python3,!gap,!cysignals,!linbox,!git,!ppl,!
330337
ARG TARGETS_PRE="all-sage-local"
331338
$RUN $CHECK_STATUS_THEN make SAGE_SPKG="sage-spkg -y -o" \${USE_MAKEFLAGS} \${TARGETS_PRE} $ENDRUN $THEN_SAVE_STATUS
332339
333-
FROM with-targets-pre as with-targets
340+
FROM with-targets-pre AS with-targets
334341
ARG NUMPROC=8
335342
ENV MAKE="make -j\${NUMPROC}"
336343
ARG USE_MAKEFLAGS="-k V=0"
337344
ENV SAGE_CHECK=warn
338345
ENV SAGE_CHECK_PACKAGES="!cython,!r,!python3,!gap,!cysignals,!linbox,!git,!ppl,!cmake,!rpy2,!sage_sws2rst"
339346
$ADD .gitignore /new/.gitignore
340347
$ADD src /new/src
341-
ADD .ci /.ci
342348
RUN cd /new && rm -rf .git && \
343349
if /.ci/retrofit-worktree.sh worktree-pre /sage; then \
344350
cd /sage && touch configure build/make/Makefile; \
@@ -347,12 +353,13 @@ RUN cd /new && rm -rf .git && \
347353
rm -rf /sage/src; \
348354
mv src /sage/src; \
349355
cd /sage && ./bootstrap && ./config.status; \
350-
fi
356+
fi; \
357+
cd /sage && rm -rf .git; rm -rf /new || echo "(error ignored)"
351358
352359
ARG TARGETS="build"
353360
$RUN $CHECK_STATUS_THEN make SAGE_SPKG="sage-spkg -y -o" \${USE_MAKEFLAGS} \${TARGETS} $ENDRUN $THEN_SAVE_STATUS
354361
355-
FROM with-targets as with-targets-optional
362+
FROM with-targets AS with-targets-optional
356363
ARG NUMPROC=8
357364
ENV MAKE="make -j\${NUMPROC}"
358365
ARG USE_MAKEFLAGS="-k V=0"

.devcontainer/portability-centos-stream-9-python3.9-minimal/devcontainer.json .devcontainer/portability-centos-stream-9-minimal/devcontainer.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
// from .devcontainer/portability-devcontainer.json.in
44
// See https://aka.ms/devcontainer.json for format details.
55
{
6-
"name": "centos-stream-9-python3.9-minimal (≥ 8-core)",
6+
"name": "centos-stream-9-minimal (≥ 8-core)",
77
"build": {
88
"dockerfile": "portability-Dockerfile",
99
// See tox.ini for definitions
1010
"args": {
11-
"SYSTEM_FACTOR": "centos-stream-9-python3.9",
11+
"SYSTEM_FACTOR": "centos-stream-9",
1212
"PACKAGE_FACTOR": "minimal",
1313
"DOCKER_TARGET": "with-targets",
1414
"DOCKER_TAG": "dev"

.devcontainer/portability-centos-7-devtoolset-gcc_11-minimal/devcontainer.json .devcontainer/portability-centos-stream-9-python3.12-minimal/devcontainer.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
// from .devcontainer/portability-devcontainer.json.in
44
// See https://aka.ms/devcontainer.json for format details.
55
{
6-
"name": "centos-7-devtoolset-gcc_11-minimal (≥ 8-core)",
6+
"name": "centos-stream-9-python3.12-minimal (≥ 8-core)",
77
"build": {
88
"dockerfile": "portability-Dockerfile",
99
// See tox.ini for definitions
1010
"args": {
11-
"SYSTEM_FACTOR": "centos-7-devtoolset-gcc_11",
11+
"SYSTEM_FACTOR": "centos-stream-9-python3.12",
1212
"PACKAGE_FACTOR": "minimal",
1313
"DOCKER_TARGET": "with-targets",
1414
"DOCKER_TAG": "dev"

.devcontainer/portability-centos-7-devtoolset-gcc_11-standard/devcontainer.json .devcontainer/portability-centos-stream-9-python3.12-standard/devcontainer.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
// from .devcontainer/portability-devcontainer.json.in
44
// See https://aka.ms/devcontainer.json for format details.
55
{
6-
"name": "centos-7-devtoolset-gcc_11-standard (≥ 8-core)",
6+
"name": "centos-stream-9-python3.12-standard (≥ 8-core)",
77
"build": {
88
"dockerfile": "portability-Dockerfile",
99
// See tox.ini for definitions
1010
"args": {
11-
"SYSTEM_FACTOR": "centos-7-devtoolset-gcc_11",
11+
"SYSTEM_FACTOR": "centos-stream-9-python3.12",
1212
"PACKAGE_FACTOR": "standard",
1313
"DOCKER_TARGET": "with-targets",
1414
"DOCKER_TAG": "dev"

.devcontainer/portability-centos-stream-9-python3.9-standard/devcontainer.json .devcontainer/portability-centos-stream-9-standard/devcontainer.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
// from .devcontainer/portability-devcontainer.json.in
44
// See https://aka.ms/devcontainer.json for format details.
55
{
6-
"name": "centos-stream-9-python3.9-standard (≥ 8-core)",
6+
"name": "centos-stream-9-standard (≥ 8-core)",
77
"build": {
88
"dockerfile": "portability-Dockerfile",
99
// See tox.ini for definitions
1010
"args": {
11-
"SYSTEM_FACTOR": "centos-stream-9-python3.9",
11+
"SYSTEM_FACTOR": "centos-stream-9",
1212
"PACKAGE_FACTOR": "standard",
1313
"DOCKER_TARGET": "with-targets",
1414
"DOCKER_TAG": "dev"

.devcontainer/portability-centos-stream-8-python3.9-minimal/devcontainer.json .devcontainer/portability-fedora-41-minimal/devcontainer.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
// from .devcontainer/portability-devcontainer.json.in
44
// See https://aka.ms/devcontainer.json for format details.
55
{
6-
"name": "centos-stream-8-python3.9-minimal (≥ 8-core)",
6+
"name": "fedora-41-minimal (≥ 8-core)",
77
"build": {
88
"dockerfile": "portability-Dockerfile",
99
// See tox.ini for definitions
1010
"args": {
11-
"SYSTEM_FACTOR": "centos-stream-8-python3.9",
11+
"SYSTEM_FACTOR": "fedora-41",
1212
"PACKAGE_FACTOR": "minimal",
1313
"DOCKER_TARGET": "with-targets",
1414
"DOCKER_TAG": "dev"

.devcontainer/portability-centos-stream-8-python3.9-standard/devcontainer.json .devcontainer/portability-fedora-41-standard/devcontainer.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
// from .devcontainer/portability-devcontainer.json.in
44
// See https://aka.ms/devcontainer.json for format details.
55
{
6-
"name": "centos-stream-8-python3.9-standard (≥ 8-core)",
6+
"name": "fedora-41-standard (≥ 8-core)",
77
"build": {
88
"dockerfile": "portability-Dockerfile",
99
// See tox.ini for definitions
1010
"args": {
11-
"SYSTEM_FACTOR": "centos-stream-8-python3.9",
11+
"SYSTEM_FACTOR": "fedora-41",
1212
"PACKAGE_FACTOR": "standard",
1313
"DOCKER_TARGET": "with-targets",
1414
"DOCKER_TAG": "dev"

.github/ISSUE_TEMPLATE/bug_report.yml

+2-3
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,8 @@ body:
4646
- **OS**: Ubuntu 20.04
4747
- Sage Version: 9.2
4848
value: |
49-
- **OS**:
50-
- **Sage Version**:
51-
render: markdown
49+
- **OS**:
50+
- **Sage Version**:
5251
validations:
5352
required: true
5453
- type: checkboxes

.github/ISSUE_TEMPLATE/failure_building_from_source.yml

+1-2
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,8 @@ body:
1717
- **OS**: Ubuntu 20.04
1818
- Sage Version: 9.2
1919
value: |
20-
- **OS**:
20+
- **OS**:
2121
- **Sage Version**:
22-
render: markdown
2322
validations:
2423
required: true
2524
- type: textarea

0 commit comments

Comments
 (0)