Skip to content

Commit

Permalink
#365 python install fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
yegor256 committed Sep 19, 2024
1 parent 827d9f0 commit 51613d6
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 55 deletions.
2 changes: 2 additions & 0 deletions DEPENDS.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ hard babel-russian
hard bibcop
hard biber
hard biblatex
hard booktabs
hard cancel
hard catchfile
hard changepage
Expand All @@ -20,6 +21,7 @@ hard datetime
hard doi
hard enumitem
hard environ
hard everyshi
hard fdsymbol
hard ffcode
hard fmtcount
Expand Down
19 changes: 10 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,10 @@ RUN apt-get update -y --fix-missing \
RUN add-apt-repository -y ppa:deadsnakes/ppa \
&& apt-get update -y --fix-missing \
&& apt-get -y install --no-install-recommends \
python3.10=* \
python3=* \
python3-venv=* \
python3-pip=* \
python3.12-venv=* \
python3.10-venv=* \
python3.10-dev=* \
python3-dev=* \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

Expand All @@ -106,9 +105,6 @@ COPY help/* /cam/help/

ENV LOCAL=/cam

COPY installs/install-texlive.sh installs/
RUN installs/install-texlive.sh

COPY installs/install-pmd.sh installs/
RUN installs/install-pmd.sh

Expand All @@ -124,10 +120,15 @@ COPY installs/install-jpeek.sh installs/
ENV JPEEK=/opt/app/jpeek.jar
RUN installs/install-jpeek.sh

COPY installs/install-poppler.sh installs/
RUN installs/install-poppler.sh

COPY installs/install-pip.sh installs/
RUN installs/install-pip.sh

COPY installs/install-poppler.sh installs/
RUN installs/install-poppler.sh
COPY installs/install-texlive.sh installs/
RUN installs/install-texlive.sh
COPY installs/install-texlive-depends.sh installs/
RUN installs/install-texlive-depends.sh

COPY . /cam
11 changes: 3 additions & 8 deletions installs/install-pip.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,7 @@ set -o pipefail
"${LOCAL}/help/assert-tool.sh" python3 --version
"${LOCAL}/help/assert-tool.sh" pip3 --version

if [ ! -d "${LOCAL}/venv" ]; then
"${LOCAL}/help/sudo.sh" python3 -m venv "${LOCAL}/venv"
fi
# see https://stackoverflow.com/a/76641565/187141
rm /usr/lib/python3.*/EXTERNALLY-MANAGED

# shellcheck source=/dev/null
source "${LOCAL}/venv/bin/activate"

"${LOCAL}/help/sudo.sh" python3 -m pip install --upgrade pip
"${LOCAL}/help/sudo.sh" python3 -m pip install -r "${LOCAL}/requirements.txt"
pip3 install -r "${LOCAL}/requirements.txt"
48 changes: 48 additions & 0 deletions installs/install-texlive-depends.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/usr/bin/env bash
# MIT License
#
# Copyright (c) 2021-2024 Yegor Bugayenko
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

set -ex
set -o pipefail

if ! tlmgr --version >/dev/null 2>&1; then
PATH=$PATH:$("${LOCAL}/help/texlive-bin.sh")
export PATH
fi

if "${LOCAL}/help/is-macos.sh"; then
if [ ! -e "${HOME}/Library/texmf" ] && [ ! -e "${HOME}/texmf/tlpkg/texlive.tlpdb" ]; then
"${LOCAL}/help/sudo.sh" tlmgr init-usertree
fi
elif "${LOCAL}/help/is-linux.sh"; then
if [ ! -e "${HOME}/texmf" ]; then
"${LOCAL}/help/sudo.sh" tlmgr init-usertree
fi
fi
"${LOCAL}/help/sudo.sh" tlmgr option repository ctan
"${LOCAL}/help/sudo.sh" tlmgr --verify-repo=none update --self
packages=()
while IFS= read -r p; do
packages+=( "${p}" )
done < <( cut -d' ' -f2 "${LOCAL}/DEPENDS.txt" | uniq )
"${LOCAL}/help/sudo.sh" tlmgr --verify-repo=none install "${packages[@]}"
"${LOCAL}/help/sudo.sh" tlmgr --verify-repo=none update --no-auto-remove "${packages[@]}" || echo 'Failed to update'
18 changes: 0 additions & 18 deletions installs/install-texlive.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,21 +46,3 @@ fi

"${LOCAL}/help/sudo.sh" tlmgr install collection-latex
pdflatex -v

if "${LOCAL}/help/is-macos.sh"; then
if [ ! -e "${HOME}/Library/texmf" ] && [ ! -e "${HOME}/texmf/tlpkg/texlive.tlpdb" ]; then
"${LOCAL}/help/sudo.sh" tlmgr init-usertree
fi
elif "${LOCAL}/help/is-linux.sh"; then
if [ ! -e "${HOME}/texmf" ]; then
"${LOCAL}/help/sudo.sh" tlmgr init-usertree
fi
fi
"${LOCAL}/help/sudo.sh" tlmgr option repository ctan
"${LOCAL}/help/sudo.sh" tlmgr --verify-repo=none update --self
packages=()
while IFS= read -r p; do
packages+=( "${p}" )
done < <( cut -d' ' -f2 "${LOCAL}/DEPENDS.txt" | uniq )
"${LOCAL}/help/sudo.sh" tlmgr --verify-repo=none install "${packages[@]}"
"${LOCAL}/help/sudo.sh" tlmgr --verify-repo=none update --no-auto-remove "${packages[@]}" || echo 'Failed to update'
29 changes: 9 additions & 20 deletions steps/env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,39 +40,33 @@ if [ "${bash_version}" -lt 5 ]; then
fi

ruby -v
rubocop -v

if [[ "$(python3 --version 2>&1 | cut -f2 -d' ')" =~ ^[1-2] ]]; then
python3 --version
echo "Python must be 3+"
exit 1
fi

flake8 --version
pylint --version

if ! tlmgr --version >/dev/null 2>&1; then
PATH=$PATH:$("${LOCAL}/help/texlive-bin.sh")
export PATH
fi

flake8 --version

pylint --version
pdflatex --version
pdftotext -v
inkscape --version
aspell --version

xmlstarlet --version

shellcheck --version

pdflatex --version

aspell --version

jq --version

multimetric --help > /dev/null

rubocop -v

inkscape --version

awk --version

parallel --version
Expand All @@ -83,12 +77,6 @@ cloc --version

pmd --version

gradle --version

mvn --version

pdftotext -v

nproc --version

# Part of coreutils (by GNU):
Expand All @@ -100,7 +88,8 @@ realpath --version
bc -v

javac -version

java -jar "${JPEEK}" --help
gradle --version
mvn --version

locale

0 comments on commit 51613d6

Please sign in to comment.