1
1
#! /bin/bash
2
+
3
+ set -e -o pipefail -x
4
+
2
5
PYVER=$( scripts/getpyver.py short)
3
6
if [[ " $1 " == " check" ]]; then
4
7
echo -e " \033[36m>> Downloading baseline for $PYVER ...\033[0m"
@@ -19,6 +22,35 @@ rm "pages/creating-a-theme.rst" "pages/extending.rst" "pages/internals.rst" "pag
19
22
LC_ALL=' en_US.UTF-8' PYTHONHASHSEED=0 nikola build --invariant
20
23
if [[ " $1 " == " check" ]]; then
21
24
echo -e " \033[36m>> Testing baseline...\033[0m"
25
+ python3 -c '
26
+ # In-place edit of copyright notes to adjust the copyright year.
27
+ for edit_me in [
28
+ "../baseline/rss.xml",
29
+ "../baseline/index.html",
30
+ "../baseline/galleries/index.html",
31
+ "../baseline/galleries/demo/index.html",
32
+ "../baseline/listings/index.html",
33
+ "../baseline/listings/hello.py.html",
34
+ "../baseline/listings/__pycache__/index.html",
35
+ "../baseline/pages/about-nikola/index.html",
36
+ "../baseline/pages/bootstrap-demo/index.html",
37
+ "../baseline/pages/dr-nikolas-vendetta/index.html",
38
+ "../baseline/pages/listings-demo/index.html",
39
+ "../baseline/pages/quickref/index.html",
40
+ "../baseline/pages/quickstart/index.html",
41
+ "../baseline/posts/welcome-to-nikola/index.html",
42
+ ]:
43
+ with open(edit_me, "rt+") as rssf:
44
+ rss = rssf.read()
45
+ copyright_prelude = "Contents © "
46
+ copyright_prelude_position = rss.find(copyright_prelude)
47
+ if -1 == copyright_prelude_position:
48
+ raise RuntimeError(f"Could not find copyright note in {edit_me}")
49
+ copyright_position = copyright_prelude_position + len(copyright_prelude)
50
+ new_rss = rss[:copyright_position] + "2024" + rss[copyright_position+4:]
51
+ rssf.seek(0, 0)
52
+ rssf.write(new_rss)
53
+ '
22
54
diff -ubwr ../baseline output
23
55
if [[ $? == 0 ]]; then
24
56
echo -e " \033[32;1m>> Baseline test successful\033[0m"
0 commit comments