Compare commits

..

No commits in common. "1e4ad2125ecbacc2d3561c198231132b9f9a1900" and "88f75d88303f8157283d40fe6d697a632b2ef08e" have entirely different histories.

3 changed files with 720 additions and 740 deletions

View file

@ -1,3 +0,0 @@
[*.sh]
indent_size = 4
indent_style = space

121
spcd.sh
View file

@ -28,12 +28,11 @@ spcd_main() {
spcd_set_https_verification_on spcd_set_https_verification_on
spcd_update_packages_catalog spcd_update_packages_catalog
spcd_upgrade_packages spcd_upgrade_packages
spcd_install_dos2unix
spcd_install_git spcd_install_git
spcd_install_python spcd_install_python
spcd_install_python_modules
# TODO move to Python # TODO move to Python
spcd_install_packages spcd_install_packages
spcd_install_python_modules
spcd_write_python_module spcd_write_python_module
spcd_switch_to_python spcd_switch_to_python
} }
@ -207,12 +206,10 @@ ${SPCD_PROJECT_ROOT}$(basename "${GITHUB_SERVER_URL}")"
# universal # universal
SPCD_DNS_FILE="/etc/resolv.conf" SPCD_DNS_FILE="/etc/resolv.conf"
SPCD_PKG_CA="ca-certificates" SPCD_PKG_CA="ca-certificates"
SPCD_PKG_DOS2UNIX="dos2unix"
SPCD_PKG_GIT="git" SPCD_PKG_GIT="git"
SPCD_PYTHON_ALIAS="python3" SPCD_PYTHON_ALIAS="python3"
spcd_split spcd_split
spcd_echo "SPCD_DNS_FILE" \ spcd_echo "SPCD_DNS_FILE" "SPCD_PKG_CA" "SPCD_PKG_GIT" "SPCD_PYTHON_ALIAS"
"SPCD_PKG_CA" "SPCD_PKG_DOS2UNIX" "SPCD_PKG_GIT" "SPCD_PYTHON_ALIAS"
# set ca command & root # set ca command & root
case "${SPCD_OS_ID}" in case "${SPCD_OS_ID}" in
"${SPCD_OS_ALMA}" | "${SPCD_OS_FEDORA}" | "${SPCD_OS_ROCKY}") "${SPCD_OS_ALMA}" | "${SPCD_OS_FEDORA}" | "${SPCD_OS_ROCKY}")
@ -590,11 +587,6 @@ spcd_upgrade_packages() {
${SPCD_PM_UPGRADE} || exit ${SPCD_PM_UPGRADE} || exit
} }
spcd_install_dos2unix() {
spcd_step "Install dos2unix"
spcd_install_package "${SPCD_PKG_DOS2UNIX}"
}
spcd_install_git() { spcd_install_git() {
spcd_step "Install Git" spcd_step "Install Git"
spcd_install_package "${SPCD_PKG_GIT}" spcd_install_package "${SPCD_PKG_GIT}"
@ -607,55 +599,11 @@ spcd_install_python() {
spcd_ln_python "${SPCD_PYTHON_COMMAND}" 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 # TODO move to Python
spcd_install_packages() { spcd_install_packages() {
# dos2unix
spcd_step "Install dos2unix"
spcd_install_package "dos2unix"
# epel # epel
spcd_step "Install EPEL" spcd_step "Install EPEL"
case "${SPCD_OS_ID}" in case "${SPCD_OS_ID}" in
@ -724,8 +672,63 @@ index-url = ${SPCD_URL_PYTHON}
spcd_split spcd_split
"${SPCD_PYTHON_ALIAS}" -m "venv" "${SPCD_PYTHON_VENV}" "${SPCD_PYTHON_ALIAS}" -m "venv" "${SPCD_PYTHON_VENV}"
spcd_split spcd_split
export PATH="${SPCD_PYTHON_VENV_BINARIES}:${PATH}" . "${SPCD_PYTHON_VENV}/bin/activate"
export VIRTUAL_ENV="${SPCD_PYTHON_VENV}" spcd_split
pip install --upgrade "pip"
spcd_split
pip install \
"mypy" \
"pelican" \
"pytest" \
"ruff" \
"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_write_python_module() {

View file

@ -53,25 +53,6 @@ def install_commands(path: str) -> None:
(user / f"{COMMANDS_PREFIX}{command}").symlink_to(path) (user / f"{COMMANDS_PREFIX}{command}").symlink_to(path)
def install_python_packages() -> None:
step("Install Python packages")
log.info("pip")
run("pip", "install", "--upgrade", "pip")
split()
packages = [
"mypy",
"pelican",
"pytest",
"ruff",
"sphinx",
"sphinx-rtd-theme",
"twine",
]
for package in packages:
log.info(package)
run("pip", "install", *packages)
def list_environment_variables() -> None: def list_environment_variables() -> None:
step("List environment variables") step("List environment variables")
for variable, value in sorted(projects.environment.items()): for variable, value in sorted(projects.environment.items()):
@ -92,7 +73,6 @@ def main(main: str) -> None:
clone_project_branch() clone_project_branch()
set_ssh() set_ssh()
install_commands(main) install_commands(main)
install_python_packages()
else: else:
function = getattr(cmd, name.replace("-", "_")) function = getattr(cmd, name.replace("-", "_"))
function(*arguments) function(*arguments)