Compare commits

..

4 commits

Author SHA1 Message Date
ad31869ee1
move env to system packages
Some checks failed
/ job (push) Failing after 1m13s
2024-08-07 19:28:36 +02:00
c8d51c04d9
err on arch venv 2024-08-07 19:26:19 +02:00
0d6cf1917c
install python modules before packages 2024-08-07 19:12:14 +02:00
fd9f8a4900
make switching log path agnostic 2024-08-07 19:08:03 +02:00

105
spcd.sh
View file

@ -30,9 +30,9 @@ spcd_main() {
spcd_upgrade_packages
spcd_install_git
spcd_install_python
spcd_install_python_modules
# TODO move to Python
spcd_install_packages
spcd_install_python_modules
spcd_write_python_module
spcd_switch_to_python
}
@ -599,6 +599,53 @@ spcd_install_python() {
spcd_ln_python "${SPCD_PYTHON_COMMAND}"
}
spcd_install_python_modules() {
spcd_step "Install Python modules"
spcd_ipm__root="$(mktemp --directory)" || exit
spcd_ipm__target="${SPCD_PYTHON_VENV_PACKAGES}"
echo "${spcd_ipm__root}"
for spcd_ipm__repository in "${SPCD_GIT_MAIN}" "${SPCD_GIT_ROOT}"; do
case "${spcd_ipm__repository}" in
http*) spcd_ipm__url="${spcd_ipm__repository}" ;;
*/*) spcd_ipm__url="${SPCD_PROJECT_ROOT}/${spcd_ipm__repository}" ;;
*) spcd_ipm__url="\
${SPCD_PROJECT_ROOT}/${SPCD_PROJECT_PATH}/${spcd_ipm__repository}" ;;
esac
spcd_ipm__name="$(basename "${spcd_ipm__url}")"
spcd_split
echo "\
${spcd_ipm__url}
"
git clone \
"${spcd_ipm__url}" \
"${spcd_ipm__root}/${spcd_ipm__name}" ||
exit
spcd_ipm__path="${spcd_ipm__root}/${spcd_ipm__name}/${spcd_ipm__name}"
echo "\
${spcd_ipm__path}
${spcd_ipm__target}"
cp --recursive "${spcd_ipm__path}" "${spcd_ipm__target}" ||
exit
# check matching of file and variable
spcd_ipm__script="${spcd_ipm__root}/${spcd_ipm__name}/spcd.sh"
if [ -f "${spcd_ipm__script}" ]; then
spcd_split
spcd_ipm__check="${spcd_ipm__root}/check.sha512sum"
sha512sum "${spcd_ipm__script}" >"${spcd_ipm__check}"
printf "%s" "${SPCD}" >"${spcd_ipm__script}"
ls -l "${spcd_ipm__script}"
dos2unix "${spcd_ipm__script}"
ls -l "${spcd_ipm__script}"
sha512sum -c "${spcd_ipm__check}" || spcd_error_ci "SPCD"
fi
done
spcd_split
spcd_ls "${spcd_ipm__target}"
spcd_split
spcd_rm "${spcd_ipm__root}"
}
# TODO move to Python
spcd_install_packages() {
# dos2unix
@ -699,7 +746,10 @@ spcd_install_packages() {
"${SPCD_OS_DEBIAN}" | "${SPCD_OS_UBUNTU}")
spcd_install_package "python3-venv"
;;
# FIXME arch
"${SPCD_OS_ARCH}")
# FIXME arch
exit 255
;;
*) ;;
esac
spcd_split
@ -720,53 +770,6 @@ index-url = ${SPCD_URL_PYTHON}
"sphinx" "sphinx-rtd-theme"
}
spcd_install_python_modules() {
spcd_step "Install Python modules"
spcd_ipm__root="$(mktemp --directory)" || exit
spcd_ipm__target="${SPCD_PYTHON_VENV_PACKAGES}"
echo "${spcd_ipm__root}"
for spcd_ipm__repository in "${SPCD_GIT_MAIN}" "${SPCD_GIT_ROOT}"; do
case "${spcd_ipm__repository}" in
http*) spcd_ipm__url="${spcd_ipm__repository}" ;;
*/*) spcd_ipm__url="${SPCD_PROJECT_ROOT}/${spcd_ipm__repository}" ;;
*) spcd_ipm__url="\
${SPCD_PROJECT_ROOT}/${SPCD_PROJECT_PATH}/${spcd_ipm__repository}" ;;
esac
spcd_ipm__name="$(basename "${spcd_ipm__url}")"
spcd_split
echo "\
${spcd_ipm__url}
"
git clone \
"${spcd_ipm__url}" \
"${spcd_ipm__root}/${spcd_ipm__name}" ||
exit
spcd_ipm__path="${spcd_ipm__root}/${spcd_ipm__name}/${spcd_ipm__name}"
echo "\
${spcd_ipm__path}
${spcd_ipm__target}"
cp --recursive "${spcd_ipm__path}" "${spcd_ipm__target}" ||
exit
# check matching of file and variable
spcd_ipm__script="${spcd_ipm__root}/${spcd_ipm__name}/spcd.sh"
if [ -f "${spcd_ipm__script}" ]; then
spcd_split
spcd_ipm__check="${spcd_ipm__root}/check.sha512sum"
sha512sum "${spcd_ipm__script}" >"${spcd_ipm__check}"
printf "%s" "${SPCD}" >"${spcd_ipm__script}"
ls -l "${spcd_ipm__script}"
dos2unix "${spcd_ipm__script}"
ls -l "${spcd_ipm__script}"
sha512sum -c "${spcd_ipm__check}" || spcd_error_ci "SPCD"
fi
done
spcd_split
spcd_ls "${spcd_ipm__target}"
spcd_split
spcd_rm "${spcd_ipm__root}"
}
spcd_write_python_module() {
spcd_step "Write Python module"
for spcd_wpm__variable in \
@ -778,7 +781,7 @@ spcd_write_python_module() {
spcd_wpm__text="${spcd_wpm__text}${spcd_wpm__value}
"
done
spcd_write "${SPCD_PYTHON_VENV_PACKAGES}/env.py" "${spcd_wpm__text}
spcd_write "${SPCD_PYTHON_PACKAGES}/env.py" "${spcd_wpm__text}
SPCD_STEP = $((SPCD_STEP + 1))
"
}
@ -789,7 +792,7 @@ spcd_switch_to_python() {
echo "\
${SPCD_PATH}
${SPCD_PYTHON_PACKAGES}/${spcd_stp__name}"
${SPCD_PYTHON_ALIAS} / ${spcd_stp__name}"
"${SPCD_PYTHON_ALIAS}" -m "${spcd_stp__name}"
}