Skip to content

Commit 9c8af76

Browse files
committed
move to latexgit_py 0.8.17 to properly handle virtual environments
1 parent 807f993 commit 9c8af76

File tree

3 files changed

+22
-10
lines changed

3 files changed

+22
-10
lines changed

make.sh

+12-5
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ set -o errexit # set -e : exit the script if any statement returns a non-true
1010

1111
echo "$(date +'%0Y-%0m-%0d %0R:%0S'): Welcome to the book building script."
1212

13+
argument="${1:-}" # get command line argument, if any
14+
1315
currentDir="$(pwd)"
1416
echo "$(date +'%0Y-%0m-%0d %0R:%0S'): We are working in directory: '$currentDir'."
1517
scriptDir="$currentDir/scripts"
@@ -22,22 +24,27 @@ rm -rf "$currentDir/website" || true
2224
echo "$(date +'%0Y-%0m-%0d %0R:%0S'): We setup a virtual environment in a temp directory."
2325
venvDir="$(mktemp -d)"
2426
echo "$(date +'%0Y-%0m-%0d %0R:%0S'): Got temp dir '$venvDir', now creating environment in it."
25-
python3 -m venv --system-site-packages "$venvDir"
27+
python3 -m venv --upgrade-deps --copies "$venvDir"
2628
echo "$(date +'%0Y-%0m-%0d %0R:%0S'): Activating virtual environment in '$venvDir'."
27-
. "$venvDir/bin/activate"
29+
source "$venvDir/bin/activate"
2830
export PYTHON_INTERPRETER="$venvDir/bin/python3"
2931
echo "$(date +'%0Y-%0m-%0d %0R:%0S'): Setting python interpreter to '$PYTHON_INTERPRETER'."
3032
echo "$(date +'%0Y-%0m-%0d %0R:%0S'): We install all required Python packages from requirements.txt to virtual environment in '$venvDir'."
31-
pip install --no-input --timeout 360 --retries 100 -r requirements.txt
33+
"$PYTHON_INTERPRETER" -m pip install --no-input --timeout 360 --retries 100 -r requirements.txt
3234
echo "$(date +'%0Y-%0m-%0d %0R:%0S'): Finished installing the requirements, now printing all installed packages."
3335
pip freeze
3436
echo "$(date +'%0Y-%0m-%0d %0R:%0S'): Finished printing all installed packages."
3537

3638
echo "$(date +'%0Y-%0m-%0d %0R:%0S'): We now execute the pdflatex compiler script."
3739
"$scriptDir/pdflatex.sh" "book.tex"
3840

39-
echo "$(date +'%0Y-%0m-%0d %0R:%0S'): We now execute the website building script."
40-
"$scriptDir/website.sh"
41+
if [ "$argument" == "--no-website" ]; then
42+
echo "$(date +'%0Y-%0m-%0d %0R:%0S'): Website generation has been disabled."
43+
else
44+
echo "$(date +'%0Y-%0m-%0d %0R:%0S'): We now execute the website building script."
45+
"$scriptDir/website.sh"
46+
echo "$(date +'%0Y-%0m-%0d %0R:%0S'): Website has been generated."
47+
fi
4148

4249
echo "$(date +'%0Y-%0m-%0d %0R:%0S'): Deactivating virtual environment."
4350
deactivate

requirements.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
# You can find it at https://thomasweise.github.io/latexgit_py,
77
# https://github.com/thomasWeise/latexgit_py, or at
88
# https://pypi.org/project/latexgit.
9-
latexgit == 0.8.14
9+
latexgit == 0.8.17
1010

1111
# minify_html is needed to minify html output.
1212
minify_html == 0.15.0
1313

1414
# for converting the additional markdown files to HTML
15-
markdown == 3.6
15+
markdown == 3.7
1616

1717
# for converting files to HTML
1818
Pygments == 2.18.0

scripts/dependencyVersions.sh

+8-3
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ 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.
16+
export PYTHON_INTERPRETER="$(readlink -f "$(which python3)")"
17+
fi
18+
1419
# see https://unix.stackexchange.com/questions/6345
1520
if [ -f /etc/os-release ]; then
1621
# freedesktop.org and systemd
@@ -63,13 +68,13 @@ fi
6368
echo ""
6469
6570
# Print the python version.
66-
pythonVersion="$(python3 --version 2>&1 | sed -n 's/.*Python\s*\([.0-9]*\)/\1/p')" || true
71+
pythonVersion="$("$PYTHON_INTERPRETER" --version 2>&1 | sed -n 's/.*Python\s*\([.0-9]*\)/\1/p')" || true
6772
pythonVersion="$(sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//' -e 's/[[:space:]][[:space:]][[:space:]]*/ /g' -e 's/\.*$//'<<<"${pythonVersion}")" || true
6873
if [ -n "$pythonVersion" ]; then
6974
echo "python: $pythonVersion"
7075
fi
7176
72-
latexgitPyVersion="$(pip freeze 2>&1 | grep latexgit | sed -n 's/.*==*\([.0-9]*\)/\1/p')" || true
77+
latexgitPyVersion="$("$PYTHON_INTERPRETER" -m pip freeze 2>&1 | grep latexgit | sed -n 's/.*==*\([.0-9]*\)/\1/p')" || true
7378
latexgitPyVersion="$(sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//' -e 's/[[:space:]][[:space:]][[:space:]]*/ /g' -e 's/\.*$//'<<<"${latexgitPyVersion}")" || true
7479
if [ -n "$latexgitPyVersion" ]; then
7580
echo "latexgit_py: $latexgitPyVersion"
@@ -81,7 +86,7 @@ if [ -n "$latexgitTexVersion" ]; then
8186
echo "latexgit_tex: $latexgitTexVersion"
8287
fi
8388
84-
pycommonsVersion="$(pip freeze | grep pycommons | sed -n 's/.*==*\([.0-9]*\)/\1/p')" || true
89+
pycommonsVersion="$("$PYTHON_INTERPRETER" -m pip freeze | grep pycommons | sed -n 's/.*==*\([.0-9]*\)/\1/p')" || true
8590
pycommonsVersion="$(sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//' -e 's/[[:space:]][[:space:]][[:space:]]*/ /g' -e 's/\.*$//'<<<"${pycommonsVersion}")" || true
8691
if [ -n "$pycommonsVersion" ]; then
8792
echo "pycommons: $pycommonsVersion"

0 commit comments

Comments
 (0)