Skip to content

Commit e31dd9b

Browse files
committed
Apply PackageJanitor
1 parent 6770508 commit e31dd9b

File tree

6 files changed

+22
-8
lines changed

6 files changed

+22
-8
lines changed

.github/workflows/Tests.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on:
88
pull_request:
99
schedule:
1010
- cron: "0 0 * * *"
11+
workflow_dispatch:
1112

1213
jobs:
1314
test:
@@ -31,6 +32,7 @@ jobs:
3132
sudo apt update
3233
sudo apt dist-upgrade -y
3334
sudo apt install -y texlive-latex-extra texlive-science
35+
cp ./CAP_project/ci_gaprc /home/gap/.gap/gaprc
3436
git clone --depth 1 https://github.com/gap-packages/AutoDoc.git
3537
git clone --depth 1 https://github.com/homalg-project/homalg_project.git
3638
# set SOURCE_DATE_EPOCH for reproducible PDFs

CAP/makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,15 @@ test-with-coverage: doc
3232
echo 'LoadPackage("profiling"); OutputJsonCoverage("stats", "coverage.json");' | gap --quitonbreak
3333

3434
test-spacing:
35-
grep -R "[^ [] " gap/*.gi && echo "Duplicate spaces found" && exit 1 || exit 0
35+
grep -R "[^ [\"] " gap/*.gi && echo "Duplicate spaces found" && exit 1 || exit 0
3636
grep -RE '[^ ] +$$' gap/* && echo "Trailing whitespace found" && exit 1 || exit 0
3737
for filename in gap/*; do \
3838
echo $$filename; \
3939
echo "LoadPackage(\"CAP\"); SizeScreen([4096]); func := ReadAsFunction(\"$$filename\"); FileString(\"gap_spacing\", DisplayString(func));" | gap --quitonbreak --banner; \
4040
echo -e "\033[0m"; \
4141
# In a perfect world, the DisplayString of a function would exactly match our code. However, our line breaks and indentation might differ from the GAP ones, \
4242
# so we remove all indentation, line breaks, and empty lines, and afterwards insert line breaks at semicolons again for better readability. \
43-
cat "gap_spacing" | tail -n +2 | head -n -2 | sed 's/\[ \]/[ ]/g' | sed 's/( )/( )/g' | sed 's/^ *//' | grep -v "^$$" | tr "\n" " " | sed 's/;/;\n/g' > modified_gap_spacing; \
43+
cat "gap_spacing" | tail -n +2 | head -n -2 | sed 's/\[ \]/[ ]/g' | sed 's/( )/( )/g' | sed 's/( :/( :/g' | sed 's/ *$$//' | sed 's/^ *//' | grep -v "^$$" | tr "\n" " " | sed 's/;/;\n/g' > modified_gap_spacing; \
4444
cat "$$filename" | grep -v "^ *[#]" | sed 's/^ *//' | grep -v "^$$" | tr "\n" " " | sed "s/;/;\n/g" > modified_custom_spacing; \
4545
# Our code might still differ from the GAP code, for example because of additional brackets. \
4646
# Thus, we diff the code once as expected and once ignoring all space. Diffing the two diffs then shows lines which only differ by spacing. \

CompilerForCAP/makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ test-spacing:
4040
echo -e "\033[0m"; \
4141
# In a perfect world, the DisplayString of a function would exactly match our code. However, our line breaks and indentation might differ from the GAP ones, \
4242
# so we remove all indentation, line breaks, and empty lines, and afterwards insert line breaks at semicolons again for better readability. \
43-
cat "gap_spacing" | tail -n +2 | head -n -2 | sed 's/\[ \]/[ ]/g' | sed 's/( )/( )/g' | sed 's/^ *//' | grep -v "^$$" | tr "\n" " " | sed 's/;/;\n/g' | grep -v '\\n' > modified_gap_spacing; \
44-
cat "$$filename" | grep -v "^ *[#]" | sed 's/^ *//' | grep -v "^$$" | tr "\n" " " | sed "s/;/;\n/g" | grep -v '\\n' > modified_custom_spacing; \
43+
cat "gap_spacing" | tail -n +2 | head -n -2 | sed 's/\[ \]/[ ]/g' | sed 's/( )/( )/g' | sed 's/( :/( :/g' | sed 's/ *$$//' | sed 's/^ *//' | grep -v "^$$" | tr "\n" " " | sed 's/;/;\n/g' > modified_gap_spacing; \
44+
cat "$$filename" | grep -v "^ *[#]" | sed 's/^ *//' | grep -v "^$$" | tr "\n" " " | sed "s/;/;\n/g" > modified_custom_spacing; \
4545
# Our code might still differ from the GAP code, for example because of additional brackets. \
4646
# Thus, we diff the code once as expected and once ignoring all space. Diffing the two diffs then shows lines which only differ by spacing. \
4747
diff modified_gap_spacing modified_custom_spacing > spacing_diff; \

FreydCategoriesForCAP/makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,15 @@ test-with-coverage: doc
3232
echo 'LoadPackage("profiling"); OutputJsonCoverage("stats", "coverage.json");' | gap --quitonbreak
3333

3434
test-spacing:
35-
grep -R "[^ [] " gap/*.gi && echo "Duplicate spaces found" && exit 1 || exit 0
35+
grep -R "[^ [\"] " gap/*.gi && echo "Duplicate spaces found" && exit 1 || exit 0
3636
grep -RE '[^ ] +$$' gap/* && echo "Trailing whitespace found" && exit 1 || exit 0
3737
for filename in gap/*; do \
3838
echo $$filename; \
3939
echo "LoadPackage(\"FreydCategoriesForCAP\"); SizeScreen([4096]); func := ReadAsFunction(\"$$filename\"); FileString(\"gap_spacing\", DisplayString(func));" | gap --quitonbreak --banner; \
4040
echo -e "\033[0m"; \
4141
# In a perfect world, the DisplayString of a function would exactly match our code. However, our line breaks and indentation might differ from the GAP ones, \
4242
# so we remove all indentation, line breaks, and empty lines, and afterwards insert line breaks at semicolons again for better readability. \
43-
cat "gap_spacing" | tail -n +2 | head -n -2 | sed 's/\[ \]/[ ]/g' | sed 's/( )/( )/g' | sed 's/^ *//' | grep -v "^$$" | tr "\n" " " | sed 's/;/;\n/g' > modified_gap_spacing; \
43+
cat "gap_spacing" | tail -n +2 | head -n -2 | sed 's/\[ \]/[ ]/g' | sed 's/( )/( )/g' | sed 's/( :/( :/g' | sed 's/ *$$//' | sed 's/^ *//' | grep -v "^$$" | tr "\n" " " | sed 's/;/;\n/g' > modified_gap_spacing; \
4444
cat "$$filename" | grep -v "^ *[#]" | sed 's/^ *//' | grep -v "^$$" | tr "\n" " " | sed "s/;/;\n/g" > modified_custom_spacing; \
4545
# Our code might still differ from the GAP code, for example because of additional brackets. \
4646
# Thus, we diff the code once as expected and once ignoring all space. Diffing the two diffs then shows lines which only differ by spacing. \

GroupRepresentationsForCAP/makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,15 @@ test-with-coverage: doc
3232
echo 'LoadPackage("profiling"); OutputJsonCoverage("stats", "coverage.json");' | gap --quitonbreak
3333

3434
test-spacing:
35-
grep -R "[^ [] " gap/*.gi && echo "Duplicate spaces found" && exit 1 || exit 0
35+
grep -R "[^ [\"] " gap/*.gi && echo "Duplicate spaces found" && exit 1 || exit 0
3636
grep -RE '[^ ] +$$' gap/* && echo "Trailing whitespace found" && exit 1 || exit 0
3737
for filename in gap/*; do \
3838
echo $$filename; \
3939
echo "LoadPackage(\"GroupRepresentationsForCAP\"); SizeScreen([4096]); func := ReadAsFunction(\"$$filename\"); FileString(\"gap_spacing\", DisplayString(func));" | gap --quitonbreak --banner; \
4040
echo -e "\033[0m"; \
4141
# In a perfect world, the DisplayString of a function would exactly match our code. However, our line breaks and indentation might differ from the GAP ones, \
4242
# so we remove all indentation, line breaks, and empty lines, and afterwards insert line breaks at semicolons again for better readability. \
43-
cat "gap_spacing" | tail -n +2 | head -n -2 | sed 's/\[ \]/[ ]/g' | sed 's/( )/( )/g' | sed 's/^ *//' | grep -v "^$$" | tr "\n" " " | sed 's/;/;\n/g' > modified_gap_spacing; \
43+
cat "gap_spacing" | tail -n +2 | head -n -2 | sed 's/\[ \]/[ ]/g' | sed 's/( )/( )/g' | sed 's/( :/( :/g' | sed 's/ *$$//' | sed 's/^ *//' | grep -v "^$$" | tr "\n" " " | sed 's/;/;\n/g' > modified_gap_spacing; \
4444
cat "$$filename" | grep -v "^ *[#]" | sed 's/^ *//' | grep -v "^$$" | tr "\n" " " | sed "s/;/;\n/g" > modified_custom_spacing; \
4545
# Our code might still differ from the GAP code, for example because of additional brackets. \
4646
# Thus, we diff the code once as expected and once ignoring all space. Diffing the two diffs then shows lines which only differ by spacing. \

ci_gaprc

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Prefer GAPInfo.UserGapRoot over other package directories to prevent accidentally testing package
2+
# versions distributed with GAP.
3+
(function()
4+
local name, package_info, pos;
5+
for name in RecNames( GAPInfo.PackagesInfo ) do
6+
package_info := GAPInfo.PackagesInfo.(name);
7+
pos := PositionProperty( package_info, info -> StartsWith( info.InstallationPath, GAPInfo.UserGapRoot ) );
8+
if pos <> fail then
9+
SetPackagePath( name, package_info[pos].InstallationPath );
10+
fi;
11+
od;
12+
end)();

0 commit comments

Comments
 (0)