Skip to content

Commit 2b36752

Browse files
committed
Merge branch 'develop' into quasimodform_implement_basis_of_weight
2 parents 561fbf8 + e2e0f8d commit 2b36752

File tree

4,875 files changed

+133360
-102089
lines changed

Some content is hidden

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

4,875 files changed

+133360
-102089
lines changed

.ci/create-changes-html.sh

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
#!/bin/sh
2+
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"
6+
exit 1
7+
fi
8+
BASE_DOC_COMMIT="$1"
9+
DOC_REPOSITORY="$2"
10+
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')
13+
# Create CHANGES.html
14+
echo '<html>' > CHANGES.html
15+
echo '<head>' >> CHANGES.html
16+
echo '<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/default.min.css">' >> CHANGES.html
17+
echo '<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js"></script>' >> CHANGES.html
18+
echo '<script>hljs.highlightAll();</script>' >> CHANGES.html
19+
cat >> CHANGES.html << EOF
20+
<script>
21+
document.addEventListener('DOMContentLoaded', () => {
22+
const diffSite = 'https://pianomister.github.io/diffsite'
23+
const baseDocURL = 'https://sagemath-tobias.netlify.app'
24+
const diffParagraphs = document.querySelectorAll('p.diff');
25+
diffParagraphs.forEach(paragraph => {
26+
const rootURL = window.location.origin;
27+
const docAnchor = paragraph.querySelector('a'); // first "a" element
28+
const url = new URL(docAnchor.href);
29+
const path = url.pathname;
30+
const anchor = document.createElement('a');
31+
anchor.href = diffSite + '/?url1=' + rootURL + path + '&url2=' + baseDocURL + path;
32+
anchor.textContent = 'compare with the base';
33+
anchor.setAttribute('target', '_blank');
34+
paragraph.appendChild(anchor);
35+
paragraph.innerHTML += '&nbsp;';
36+
const hunkAnchors = paragraph.querySelectorAll('a.hunk');
37+
hunkAnchors.forEach(hunkAnchor => {
38+
const url = new URL(hunkAnchor.href);
39+
const path = url.pathname;
40+
const pathHash = path + url.hash.replace('#', '%23');
41+
const anchor = document.createElement('a');
42+
anchor.href = diffSite + '/?url1=' + rootURL + pathHash + '&url2=' + baseDocURL + path;
43+
anchor.textContent = hunkAnchor.textContent;
44+
anchor.setAttribute('target', '_blank');
45+
paragraph.appendChild(anchor);
46+
paragraph.innerHTML += '&nbsp;';
47+
});
48+
});
49+
});
50+
</script>
51+
EOF
52+
echo '</head>' >> CHANGES.html
53+
echo '<body>' >> CHANGES.html
54+
(cd $DOC_REPOSITORY && git diff $BASE_DOC_COMMIT -- *.html) > diff.txt
55+
python3 - << EOF
56+
import os, re, html
57+
with open('diff.txt', 'r') as f:
58+
diff_text = f.read()
59+
diff_blocks = re.split(r'^(?=diff --git)', diff_text, flags=re.MULTILINE)
60+
out_blocks = []
61+
for block in diff_blocks:
62+
match = re.search(r'^diff --git a/(.*) b/\1', block, flags=re.MULTILINE)
63+
if match:
64+
doc = match.group(1)
65+
path = 'html/' + doc
66+
file_path = os.path.join('$DOC_REPOSITORY', doc)
67+
with open(file_path, 'r') as file:
68+
content = file.readlines()
69+
count = 0
70+
for line in block.splitlines():
71+
if line.startswith('@@ -'):
72+
line_number = int(re.search(r'@@ -(\d+)', line).group(1))
73+
for i in range(line_number, -1, -1):
74+
if content[i].startswith('<'):
75+
count += 1
76+
content[i] = f'<span id="hunk{count}" style="visibility: hidden;"></span>' + content[i]
77+
break
78+
with open(file_path, 'w') as file:
79+
file.writelines(content)
80+
hunks = '&nbsp;'.join(f'<a href="{path}#hunk{i+1}" class="hunk" target="_blank">#{i + 1}</a>' for i in range(count))
81+
out_blocks.append(f'<p class="diff"><a href="{path}">{doc}</a>&nbsp;' + hunks + '&emsp;</p>'
82+
+ '\n<pre><code class="language-diff">'
83+
+ html.escape(block).strip() + '</code></pre>')
84+
output_text = '\n'.join(out_blocks)
85+
with open('diff.html', 'w') as f:
86+
f.write(output_text)
87+
EOF
88+
cat diff.html >> CHANGES.html
89+
echo '</body>' >> CHANGES.html
90+
echo '</html>' >> CHANGES.html
91+
rm diff.txt diff.html

.ci/describe-system.sh

Lines changed: 0 additions & 23 deletions
This file was deleted.

.ci/merge-fixes.sh

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
#!/bin/sh
2+
# Apply open PRs labeled "blocker" from sagemath/sage as patches.
3+
# This script is invoked by various workflows in .github/workflows
4+
#
5+
# The repository variable SAGE_CI_FIXES_FROM_REPOS can be set
6+
# to customize this for CI runs in forks:
7+
#
8+
# - If set to a whitespace-separated list of repositories, use them instead of sagemath/sage.
9+
# - If set to "none", do not apply any PRs.
10+
#
11+
# https://docs.github.com/en/actions/learn-github-actions/variables#creating-configuration-variables-for-a-repository
12+
export GIT_AUTHOR_NAME="ci-sage workflow"
13+
export GIT_AUTHOR_EMAIL="[email protected]"
14+
export GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME"
15+
export GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL"
16+
mkdir -p upstream
17+
for REPO in ${SAGE_CI_FIXES_FROM_REPOSITORIES:-sagemath/sage}; do
18+
case $REPO in
19+
none)
20+
echo "Nothing to do for 'none' in SAGE_CI_FIXES_FROM_REPOSITORIES"
21+
;;
22+
*/*)
23+
echo "Getting open PRs with 'blocker' status from https://github.com/$REPO/pulls?q=is%3Aopen+label%3A%22p%3A+blocker+%2F+1%22"
24+
GH="gh -R $REPO"
25+
REPO_FILE="upstream/ci-fixes-${REPO%%/*}-${REPO##*/}"
26+
PRs="$($GH pr list --label "p: blocker / 1" --json number --jq '.[].number' | tee $REPO_FILE)"
27+
date -u +"%Y-%m-%dT%H:%M:%SZ" > $REPO_FILE.date # Record the date, for future reference
28+
if [ -z "$PRs" ]; then
29+
echo "Nothing to do: Found no open PRs with 'blocker' status in $REPO."
30+
else
31+
echo "Found open PRs with 'blocker' status in $REPO: $(echo $PRs)"
32+
git tag -f test_base
33+
git commit -q -m "Uncommitted changes" --no-allow-empty -a
34+
for a in $PRs; do
35+
# We used to pull the branch and merge it (after unshallowing), but when run on PRs that are
36+
# based on older releases, it has the side effect of updating to this release,
37+
# which may be confusing.
38+
#
39+
# Here, we obtain the "git am"-able patch of the PR branch.
40+
# This also makes it unnecessary to unshallow the repository.
41+
#
42+
# Considered alternative: Use https://github.com/$REPO/pull/$a.diff,
43+
# which squashes everything into one diff without commit metadata.
44+
PULL_URL="https://github.com/$REPO/pull/$a"
45+
PULL_FILE="$REPO_FILE-$a"
46+
PATH=build/bin:$PATH build/bin/sage-download-file --quiet "$PULL_URL.patch" $PULL_FILE.patch
47+
date -u +"%Y-%m-%dT%H:%M:%SZ" > $PULL_FILE.date # Record the date, for future reference
48+
LAST_SHA=$(sed -n -E '/^From [0-9a-f]{40}/s/^From ([0-9a-f]{40}).*/\1/p' $PULL_FILE.patch | tail -n 1)
49+
COMMITS_URL="https://github.com/$REPO/commits/$LAST_SHA"
50+
echo "::group::Applying PR $PULL_URL @ $COMMITS_URL as a patch"
51+
export GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME applying $PULL_URL @ $COMMITS_URL"
52+
if git am --signoff --empty=keep < $PULL_FILE.patch; then
53+
echo "---- Applied patch --------------------------------------------------------------------------------"
54+
cat $PULL_FILE.patch
55+
echo "--------------------------------------------------------------------8<-----------------------------"
56+
echo "::endgroup::"
57+
elif git am --abort \
58+
&& if git fetch --unshallow --all > /dev/null 2>&1; then echo "Unshallowed"; fi \
59+
&& echo "Retrying with 3-way merge" \
60+
&& git am --empty=keep --3way < $PULL_FILE.patch; then
61+
echo "---- Applied patch --------------------------------------------------------------------------------"
62+
cat $PULL_FILE.patch
63+
echo "--------------------------------------------------------------------8<-----------------------------"
64+
echo "::endgroup::"
65+
else
66+
echo "---- Failure applying patch -----------------------------------------------------------------------"
67+
git am --signoff --show-current-patch=diff
68+
echo "--------------------------------------------------------------------8<-----------------------------"
69+
echo "::endgroup::"
70+
echo "Failure applying $PULL_URL as a patch, resetting"
71+
git am --signoff --abort
72+
fi
73+
done
74+
fi
75+
;;
76+
*)
77+
echo "Repository variable SAGE_CI_FIXES_FROM_REPOSITORIES, if set, should be a whitespace-separated list of repositories or 'none'"
78+
echo "Got: $SAGE_CI_FIXES_FROM_REPOSITORIES"
79+
exit 1
80+
;;
81+
esac
82+
done

.ci/protect-secrets.sh

Lines changed: 0 additions & 40 deletions
This file was deleted.

.ci/retrofit-worktree.sh

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!/bin/sh
2+
if [ $# != 2 ]; then
3+
echo >&2 "usage: $0 WORKTREE_NAME WORKTREE_DIRECTORY"
4+
echo >&2 "Ensures that the current working directory is a git repository,"
5+
echo >&2 "then makes WORKTREE_DIRECTORY a git worktree named WORKTREE_NAME."
6+
fi
7+
WORKTREE_NAME="$1"
8+
WORKTREE_DIRECTORY="$2"
9+
10+
export GIT_AUTHOR_NAME="ci-sage workflow"
11+
export GIT_AUTHOR_EMAIL="[email protected]"
12+
export GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME"
13+
export GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL"
14+
15+
# Set globally for other parts of the workflow
16+
git config --global user.name "$GIT_AUTHOR_NAME"
17+
git config --global user.email "$GIT_AUTHOR_EMAIL"
18+
19+
set -ex
20+
21+
# If actions/checkout downloaded our source tree using the GitHub REST API
22+
# instead of with git (because do not have git installed in our image),
23+
# we first make the source tree a repo.
24+
if [ ! -d .git ]; then git init && git add -A && git commit --quiet -m "new"; fi
25+
26+
# Tag this state of the source tree "new". This is what we want to build and test.
27+
git tag -f new
28+
29+
# Our container image contains a source tree in $WORKTREE_DIRECTORY with a full build of Sage.
30+
# But $WORKTREE_DIRECTORY is not a git repository.
31+
# We make $WORKTREE_DIRECTORY a worktree whose index is at tag "new".
32+
# We then commit the current sources and set the tag "old". (This keeps all mtimes unchanged.)
33+
# Then we update worktree and index with "git reset --hard new".
34+
# (This keeps mtimes of unchanged files unchanged and mtimes of changed files newer than unchanged files.)
35+
# Finally we reset the index to "old". (This keeps all mtimes unchanged.)
36+
# The changed files now show up as uncommitted changes.
37+
# The final "git add -N" makes sure that files that were added in "new" do not show
38+
# as untracked files, which would be removed by "git clean -fx".
39+
git worktree add --detach $WORKTREE_NAME
40+
rm -rf $WORKTREE_DIRECTORY/.git && mv $WORKTREE_NAME/.git $WORKTREE_DIRECTORY/
41+
rm -rf $WORKTREE_NAME && ln -s $WORKTREE_DIRECTORY $WORKTREE_NAME
42+
if [ ! -f $WORKTREE_NAME/.gitignore ]; then cp .gitignore $WORKTREE_NAME/; fi
43+
(cd $WORKTREE_NAME && git add -A && git commit --quiet --allow-empty -m "old" -a && git tag -f old && git reset --hard new && git reset --quiet old && git add -N . && git status)

.devcontainer/onCreate-conda.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ set -e
44
# Create conda environment
55
./bootstrap-conda
66
conda install mamba -n base -c conda-forge -y
7-
mamba env create --file src/environment-dev.yml || mamba env update --file src/environment-dev.yml
7+
mamba env create --file src/environment-dev-3.11.yml || mamba env update --file src/environment-dev-3.11.yml
88
conda init bash
99

1010
# Build sage

0 commit comments

Comments
 (0)