Skip to content

Commit 1dd5d9d

Browse files
committed
improved scripts
1 parent 3cca516 commit 1dd5d9d

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

scripts/dependencyVersions.sh

+13-13
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ set -o errexit # set -e : exit the script if any statement returns a non-true
1111
# get the script directory
1212
scriptDir="$(dirname "$0")"
1313

14-
if [[ $(declare -p PYTHON_INTERPRETER) != declare\ ?x* ]]; then
15-
# We have to find it by ourselves.
14+
# Find the Python interpreter.
15+
if [[ $(declare -p PYTHON_INTERPRETER 2>/dev/null) != declare\ ?x* ]]; then
1616
export PYTHON_INTERPRETER="$(readlink -f "$(which python3)")"
1717
fi
1818

@@ -58,7 +58,7 @@ if [ -n "$osAndVersion" ]; then
5858
echo "$osAndVersion"
5959
fi
6060
61-
linuxVersion="$(uname -mrs 2>&1)" || true
61+
linuxVersion="$(uname -mrs 2>/dev/null )" || true
6262
linuxVersion="$(sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//' -e 's/[[:space:]][[:space:]][[:space:]]*/ /g' -e 's/\.*$//'<<<"${linuxVersion}")" || true
6363
if [ -n "$linuxVersion" ]; then
6464
echo "$linuxVersion"
@@ -68,58 +68,58 @@ fi
6868
echo ""
6969
7070
# Print the python version.
71-
pythonVersion="$("$PYTHON_INTERPRETER" --version 2>&1 | sed -n 's/.*Python\s*\([.0-9]*\)/\1/p')" || true
71+
pythonVersion="$("$PYTHON_INTERPRETER" --version 2>/dev/null | sed -n 's/.*Python\s*\([.0-9]*\)/\1/p')" || true
7272
pythonVersion="$(sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//' -e 's/[[:space:]][[:space:]][[:space:]]*/ /g' -e 's/\.*$//'<<<"${pythonVersion}")" || true
7373
if [ -n "$pythonVersion" ]; then
7474
echo "python: $pythonVersion"
7575
fi
7676
77-
latexgitPyVersion="$("$PYTHON_INTERPRETER" -m pip freeze 2>&1 | grep latexgit | sed -n 's/.*==*\([.0-9]*\)/\1/p')" || true
77+
latexgitPyVersion="$("$PYTHON_INTERPRETER" -m pip freeze 2>/dev/null | grep latexgit | sed -n 's/.*==*\([.0-9]*\)/\1/p')" || true
7878
latexgitPyVersion="$(sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//' -e 's/[[:space:]][[:space:]][[:space:]]*/ /g' -e 's/\.*$//'<<<"${latexgitPyVersion}")" || true
7979
if [ -n "$latexgitPyVersion" ]; then
8080
echo "latexgit_py: $latexgitPyVersion"
8181
fi
8282
83-
latexgitTexVersion="$(less $scriptDir/../styles/latexgit.sty | sed -n 's/.*\\ProvidesPackage{latexgit}\[[0-9\/]* *\([.0-9]*\) .*\].*/\1/p')" || true
83+
latexgitTexVersion="$(less $scriptDir/../styles/latexgit.sty 2>/dev/null | sed -n 's/.*\\ProvidesPackage{latexgit}\[[0-9\/]* *\([.0-9]*\) .*\].*/\1/p')" || true
8484
latexgitTexVersion="$(sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//' -e 's/[[:space:]][[:space:]][[:space:]]*/ /g' -e 's/\.*$//'<<<"${latexgitTexVersion}")" || true
8585
if [ -n "$latexgitTexVersion" ]; then
8686
echo "latexgit_tex: $latexgitTexVersion"
8787
fi
8888
89-
pycommonsVersion="$("$PYTHON_INTERPRETER" -m pip freeze | grep pycommons | sed -n 's/.*==*\([.0-9]*\)/\1/p')" || true
89+
pycommonsVersion="$("$PYTHON_INTERPRETER" -m pip freeze 2>/dev/null | grep pycommons | sed -n 's/.*==*\([.0-9]*\)/\1/p')" || true
9090
pycommonsVersion="$(sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//' -e 's/[[:space:]][[:space:]][[:space:]]*/ /g' -e 's/\.*$//'<<<"${pycommonsVersion}")" || true
9191
if [ -n "$pycommonsVersion" ]; then
9292
echo "pycommons: $pycommonsVersion"
9393
fi
9494
95-
pdflatexVersion="$(pdflatex --version 2>&1 | grep 'pdfTeX 3')" || true
95+
pdflatexVersion="$(pdflatex --version 2>/dev/null | grep 'pdfTeX 3')" || true
9696
pdflatexVersion="$(sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//' -e 's/[[:space:]][[:space:]][[:space:]]*/ /g' -e 's/\.*$//'<<<"${pdflatexVersion}")" || true
9797
if [ -n "$pdflatexVersion" ]; then
9898
echo "pdflatex: $pdflatexVersion"
9999
fi
100100
101-
biberVersion="$(biber --version 2>&1 | sed -n 's/.*:\s*\([.0-9]*\)/\1/p')" || true
101+
biberVersion="$(biber --version 2>/dev/null | sed -n 's/.*:\s*\([.0-9]*\)/\1/p')" || true
102102
biberVersion="$(sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//' -e 's/[[:space:]][[:space:]][[:space:]]*/ /g' -e 's/\.*$//'<<<"${biberVersion}")" || true
103103
if [ -n "$biberVersion" ]; then
104104
echo "biber: $biberVersion"
105105
fi
106106
107-
makeglossariesVersion="$(makeglossaries --version 2>&1 | grep Version | sed -n 's/.*Version\s*\([.0-9]*\)/\1/p')" || true
107+
makeglossariesVersion="$(makeglossaries --version 2>/dev/null | grep Version | sed -n 's/.*Version\s*\([.0-9]*\)/\1/p')" || true
108108
makeglossariesVersion="$(sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//' -e 's/[[:space:]][[:space:]][[:space:]]*/ /g' -e 's/\.*$//'<<<"${makeglossariesVersion}")" || true
109109
if [ -n "$makeglossariesVersion" ]; then
110110
echo "makeglossaries: $makeglossariesVersion"
111111
fi
112112
113-
makeindexVersion="$(echo '' | makeindex 2>&1 | grep makeindex | sed -n 's/.*version\s*\([.0-9]*\)/\1/p')" || true
113+
makeindexVersion="$(echo '' | makeindex 2>/dev/null | grep makeindex | sed -n 's/.*version\s*\([.0-9]*\)/\1/p')" || true
114114
makeindexVersion="$(sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//' -e 's/[[:space:]][[:space:]][[:space:]]*/ /g' -e 's/\.*$//'<<<"${makeindexVersion}")" || true
115115
if [ -n "$makeindexVersion" ]; then
116116
echo "makeindex: $makeindexVersion"
117117
fi
118118
119-
ghostscriptVersion="$(gs --help 2>&1 | head -n 1 | sed -e 's/GPL//i' | sed -e 's/GhostScript//i')" || true
119+
ghostscriptVersion="$(gs --help 2>/dev/null | head -n 1 | sed -e 's/GPL//i' | sed -e 's/GhostScript//i')" || true
120120
ghostscriptVersion="$(sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//' -e 's/[[:space:]][[:space:]][[:space:]]*/ /g' -e 's/\.*$//'<<<"${ghostscriptVersion}")" || true
121121
if [ -z "$ghostscriptVersion" ]; then
122-
ghostscriptVersion="$(gs --version 2>&1)" || true
122+
ghostscriptVersion="$(gs --version 2>/dev/null)" || true
123123
ghostscriptVersion="$(sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//' -e 's/[[:space:]][[:space:]][[:space:]]*/ /g' -e 's/\.*$//'<<<"${ghostscriptVersion}")" || true
124124
fi
125125
if [ -n "$ghostscriptVersion" ]; then

scripts/pdflatex.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ bibProgram="$(readlink -f "$(which biber)")"
2929
echo "$(date +'%0Y-%0m-%0d %0R:%0S'): We will use '$bibProgram' to process bibliography files."
3030
"$bibProgram" --version
3131

32-
if [[ $(declare -p PYTHON_INTERPRETER) == declare\ ?x* ]]; then
32+
if [[ $(declare -p PYTHON_INTERPRETER 2>/dev/null) == declare\ ?x* ]]; then
3333
echo "$(date +'%0Y-%0m-%0d %0R:%0S'): Found python interpreter as: '$PYTHON_INTERPRETER'"
3434
else
3535
export PYTHON_INTERPRETER="$(readlink -f "$(which python3)")"

scripts/website.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ echo "$(date +'%0Y-%0m-%0d %0R:%0S'): The script directory is '$scriptDir'."
1616
currentDir="$(pwd)"
1717
echo "$(date +'%0Y-%0m-%0d %0R:%0S'): We are working in directory: '$currentDir'."
1818

19-
if [[ $(declare -p PYTHON_INTERPRETER) == declare\ ?x* ]]; then
19+
if [[ $(declare -p PYTHON_INTERPRETER 2>/dev/null) == declare\ ?x* ]]; then
2020
echo "$(date +'%0Y-%0m-%0d %0R:%0S'): Found python interpreter as: '$PYTHON_INTERPRETER'"
2121
else
2222
export PYTHON_INTERPRETER="$(readlink -f "$(which python3)")"

0 commit comments

Comments
 (0)