Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update favicon and fix pre-commit hook helper script #384

Merged
merged 3 commits into from
Mar 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 15 additions & 10 deletions .github/isbin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,32 @@ size_threshold=65536

SAVEIFS=$IFS
IFS=$(echo -en "\n\b")
OS=$(uname -a | cut -d ' ' -f 1)

for f in $@; do
echo $f
size=$(stat --format %s $f)
case "$OS" in
Linux) size=$(stat --format "%s" $f);;
Darwin) size=$(stat -f "%z" $f);;
*) echo "Error: unsupported operating system $OS" >&2; exit 1;;
esac
if [ $size -gt $size_threshold ]; then
echo "file exceeds maximum allowable size"
echo "raw data and ipynb files should go in scico-data"
exit 1
echo "file exceeds maximum allowable size of $size_threshold bytes"
echo "raw data and ipynb files should go in scico-data"
exit 2
fi
charset=$(file -b --mime $f | sed -e 's/.*charset=//')
if [ ! -L "$f" ] && [ "$charset" = "binary" ]; then
echo "binary files cannot be commited to the repository"
echo "raw data and ipynb files should go in scico-data"
exit 2
echo "binary files cannot be commited to the repository"
echo "raw data and ipynb files should go in scico-data"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this always the case?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, with a very small number of exceptions (such as scico.ico).

exit 3
fi
basename=$(basename -- "$f")
ext="${basename##*.}"
if [ "$ext" = "ipynb" ]; then
echo "ipynb files cannot be commited to the repository"
echo "raw data and ipynb files should go in scico-data"
exit 3
echo "ipynb files cannot be commited to the repository"
echo "raw data and ipynb files should go in scico-data"
exit 4
fi
done

Expand Down
Binary file modified docs/source/_static/scico.ico
Binary file not shown.