Skip to content

Commit 2567058

Browse files
refactor: Update python debian install
1 parent 469669b commit 2567058

1 file changed

Lines changed: 0 additions & 62 deletions

File tree

.devcontainer/library-scripts/python-debian.sh

Lines changed: 0 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,6 @@ PYTHON_VERSION=${1:-"latest"} # "system" else "latest"
66
USERNAME=${2:-"automatic"}
77
PYTHON_INSTALL_PATH=${3:-"/usr/local/python"}
88
UPDATE_RC=${4:-"true"}
9-
export PIPX_HOME=${5:-"/usr/local/python"} # "/usr/local/py-utils"
10-
INSTALL_PYTHON_TOOLS=${6:-"true"}
11-
12-
DEFAULT_UTILS=(
13-
"autopep8"
14-
"bandit"
15-
# "black"
16-
"flake8"
17-
# "isort"
18-
"mypy"
19-
"pycodestyle"
20-
"pydocstyle"
21-
"pylint"
22-
"pytest"
23-
"twine"
24-
"yapf"
25-
)
269

2710
if [ "$(id -u)" -ne 0 ]; then
2811
echo -e 'Script must be run as root. Use sudo, su, or add "USER root" to your Dockerfile before running this script.'
@@ -185,48 +168,3 @@ if [ "${PYTHON_VERSION}" != "none" ]; then
185168
fi
186169
updaterc "if [[ \"\${PATH}\" != *\"${PYTHON_INSTALL_PATH}/bin\"* ]]; then export PATH=${PYTHON_INSTALL_PATH}/bin:\${PATH}; fi"
187170
fi
188-
189-
if [ "${INSTALL_PYTHON_TOOLS}" != "true" ]; then
190-
exit 0
191-
fi
192-
193-
export PIPX_BIN_DIR="${PIPX_HOME}/bin"
194-
export PATH="${PYTHON_INSTALL_PATH}/bin:${PIPX_BIN_DIR}:${PATH}"
195-
196-
if ! grep -e '^pipx:' </etc/group >/dev/null 2>&1; then
197-
groupadd --system pipx
198-
fi
199-
usermod --append --groups pipx ${USERNAME}
200-
umask 0002
201-
mkdir --parents ${PIPX_BIN_DIR}
202-
chown :pipx ${PIPX_HOME} ${PIPX_BIN_DIR}
203-
chmod g+s ${PIPX_HOME} ${PIPX_BIN_DIR}
204-
205-
if [ ${PYTHON_VERSION} != "system" ]; then
206-
${PYTHON_INSTALL_PATH}/bin/python3 -m pip install --no-cache-dir --upgrade pip
207-
fi
208-
209-
export PYTHONUSERBASE=/tmp/pip-tmp
210-
export PIP_CACHE_DIR=/tmp/pip-tmp/cache
211-
pipx_path=""
212-
if ! type pipx >/dev/null 2>&1; then
213-
pip3 install --disable-pip-version-check --no-cache-dir --user pipx 2>&1
214-
/tmp/pip-tmp/bin/pipx install --pip-args=--no-cache-dir pipx
215-
pipx_path=$PYTHONUSERBASE"/bin/"
216-
fi
217-
for util in "${DEFAULT_UTILS[@]}"; do
218-
if ! type ${util} >/dev/null 2>&1; then
219-
${pipx_path}pipx install --system-site-packages --pip-args '--no-cache-dir --force-reinstall' ${util}
220-
else
221-
echo "${util} already installed. Skipping."
222-
fi
223-
done
224-
rm -rf /tmp/pip-tmp
225-
226-
updaterc "$(
227-
cat <<EOF
228-
export PIPX_HOME="${PIPX_HOME}"
229-
export PIPX_BIN_DIR="${PIPX_BIN_DIR}"
230-
if [[ "\${PATH}" != *"\${PIPX_BIN_DIR}"* ]]; then export PATH="\${PATH}:\${PIPX_BIN_DIR}"; fi
231-
EOF
232-
)"

0 commit comments

Comments
 (0)