Skip to content

Commit be3c247

Browse files
committed
better dependency listing
1 parent 530469a commit be3c247

File tree

4 files changed

+52
-2
lines changed

4 files changed

+52
-2
lines changed

bookbase

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/bin/bash -
2+
3+
# This script prints the versions of the dependencies and software environment under which the book was built.
4+
# It uses the basic dependency versions given in bookbase and adds python tool information.
5+
6+
# strict error handling
7+
set -o pipefail # trace ERR through pipes
8+
set -o errtrace # trace ERR through 'time command' and other functions
9+
set -o nounset # set -u : exit the script if you try to use an uninitialized variable
10+
set -o errexit # set -e : exit the script if any statement returns a non-true return value
11+
12+
hasOutput=false # Do we have some output and need a separator?
13+
14+
# Check the versions of the tools and packages.
15+
for pack in "pytest" "pytest-timeout" "mypy" "ruff" "pylint"; do
16+
version="$(python3 -m pip show "$pack" 2>/dev/null || true)"
17+
if [ -z "$version" ]; then
18+
# pytest or the plugin is not installed, so we install it now.
19+
# We do this silently, without printing any information...
20+
python3 -m pip install --require-virtualenv "$pack" 1>/dev/null 2>&1
21+
version="$(python3 -m pip show "$pack" 2>/dev/null)"
22+
fi
23+
24+
# For each tool or plugin, we get the version separately.
25+
version="$(grep Version: <<< "$version")"
26+
version="$(sed -n 's/.*Version:\s*\([.0-9]*\)/\1/p' <<< "$version")"
27+
if [ -n "$version" ]; then # ... and we concatenate them
28+
echo "$pack: $version"
29+
hasOutput=true
30+
fi
31+
done
32+
33+
# separator if we have anything
34+
if [ "$hasOutput" = true ]; then
35+
echo ""
36+
fi
+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash -
2+
3+
# This script prints the versions of the dependencies and software environment under which the book was built.
4+
# It uses the basic dependency versions given in bookbase and adds python tool information.
5+
6+
# strict error handling
7+
set -o pipefail # trace ERR through pipes
8+
set -o errtrace # trace ERR through 'time command' and other functions
9+
set -o nounset # set -u : exit the script if you try to use an uninitialized variable
10+
set -o errexit # set -e : exit the script if any statement returns a non-true return value
11+
12+
# get the script directory
13+
scriptDir="$(readlink -f "$(dirname "$0")")"
14+
"bookbase/scripts/dependencyVersions.sh" "$scriptDir/__dependencyVersionsInner.sh" "${@:1}"

text/front/preface/preface.tex

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,4 +66,4 @@ \chapter*{Preface}%
6666
%
6767
\strut\vfill\strut%
6868
This book was built using the following software:%
69-
\gitOutputWithStyle{}{}{bookbase/scripts/dependencyVersions.sh}{versions}{}{text_style}%
69+
\gitOutputWithStyle{}{}{text/front/preface/dependencyVersions.sh}{versions}{}{text_style}%

0 commit comments

Comments
 (0)