From 17c9b919aac8cb113e56e617d7f943ec2abb058e Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 6 Aug 2024 15:51:26 +0200 Subject: [PATCH 1/8] install venv if necessary --- readme.md | 1 - spcd.sh | 9 +++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/readme.md b/readme.md index 30b7aa9..d2b383c 100644 --- a/readme.md +++ b/readme.md @@ -84,7 +84,6 @@ from various contexts of CA, CI and OCI / OS. * actions * includes * handle python virtual environment - * install venv if necessary * upgrade pip * install packages * ruff diff --git a/spcd.sh b/spcd.sh index 6af63bf..1f0d8fd 100644 --- a/spcd.sh +++ b/spcd.sh @@ -653,6 +653,15 @@ spcd_install_packages() { ;; *) ;; esac + # python venv + spcd_step "Install Python virtual environment" + case "${SPCD_OS_ID}" in + "${SPCD_OS_DEBIAN}" | "${SPCD_OS_UBUNTU}") + spcd_install_package "python3-venv" + ;; + # FIXME arch + *) ;; + esac # rsync spcd_step "Install Rsync" spcd_install_package "rsync" From 124200a5ade6394ddd06d8af3b22b2ea97c5e475 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 6 Aug 2024 17:01:38 +0200 Subject: [PATCH 2/8] readme/pip --- readme.md | 1 + 1 file changed, 1 insertion(+) diff --git a/readme.md b/readme.md index d2b383c..19121e6 100644 --- a/readme.md +++ b/readme.md @@ -84,6 +84,7 @@ from various contexts of CA, CI and OCI / OS. * actions * includes * handle python virtual environment + * configure pip * upgrade pip * install packages * ruff From 4ce608c7f8153fe21008f50ba0d5e64f5c223509 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 6 Aug 2024 19:29:24 +0200 Subject: [PATCH 3/8] configure pip --- readme.md | 3 ++- spcd.sh | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/readme.md b/readme.md index 19121e6..808e89f 100644 --- a/readme.md +++ b/readme.md @@ -56,6 +56,7 @@ from various contexts of CA, CI and OCI / OS. | SPCD_URL_DEBIAN | Debian repository URL | https://deb.debian.org | | SPCD_URL_EPEL | EPEL repository URL | https://dl.fedoraproject.org | | SPCD_URL_FEDORA | Fedora repository URL | https://rpmfind.net | +| SPCD_URL_PYTHON | Python repository URL | https://pypi.org/project | | SPCD_URL_ROCKY | Rocky repository URL | https://dl.rockylinux.org | | SPCD_URL_UBUNTU | Ubuntu repository URL | https://ubuntu.mirrors.ovh.net | @@ -84,7 +85,7 @@ from various contexts of CA, CI and OCI / OS. * actions * includes * handle python virtual environment - * configure pip + * activate venv * upgrade pip * install packages * ruff diff --git a/spcd.sh b/spcd.sh index 1f0d8fd..ad990cc 100644 --- a/spcd.sh +++ b/spcd.sh @@ -7,6 +7,7 @@ [ -n "${SPCD_DNS_1}" ] || SPCD_DNS_1="9.9.9.9" [ -n "${SPCD_GIT_MAIN}" ] || SPCD_GIT_MAIN="spcd" [ -n "${SPCD_GIT_ROOT}" ] || SPCD_GIT_ROOT="rwx" +[ -n "${SPCD_URL_PYTHON}" ] || SPCD_URL_PYTHON="https://pypi.org/project" # main spcd_main() { @@ -662,6 +663,11 @@ spcd_install_packages() { # FIXME arch *) ;; esac + spcd_split + spcd_write "/etc/pip.conf" "\ +[global] +index-url = ${SPCD_URL_PYTHON} +" # rsync spcd_step "Install Rsync" spcd_install_package "rsync" From e770a6e721dc5ac2bef528a36558f29f7278bae4 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 6 Aug 2024 19:30:16 +0200 Subject: [PATCH 4/8] readme/create --- readme.md | 1 + 1 file changed, 1 insertion(+) diff --git a/readme.md b/readme.md index 808e89f..08f2465 100644 --- a/readme.md +++ b/readme.md @@ -85,6 +85,7 @@ from various contexts of CA, CI and OCI / OS. * actions * includes * handle python virtual environment + * create venv * activate venv * upgrade pip * install packages From a9c8f13068a6b9a100907fd3eb17f7fbc5db34f5 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 6 Aug 2024 19:45:22 +0200 Subject: [PATCH 5/8] venv/create,activate --- readme.md | 2 -- spcd.sh | 4 ++++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/readme.md b/readme.md index 08f2465..f9c8ffa 100644 --- a/readme.md +++ b/readme.md @@ -85,8 +85,6 @@ from various contexts of CA, CI and OCI / OS. * actions * includes * handle python virtual environment - * create venv - * activate venv * upgrade pip * install packages * ruff diff --git a/spcd.sh b/spcd.sh index ad990cc..4b169f8 100644 --- a/spcd.sh +++ b/spcd.sh @@ -668,6 +668,10 @@ spcd_install_packages() { [global] index-url = ${SPCD_URL_PYTHON} " + spcd_split + spcd_ip__venv="/opt/venv" + "${SPCD_PYTHON_ALIAS}" -m "venv" "${spcd_ip__venv}" + . "${spcd_ip__venv}/bin/activate" # rsync spcd_step "Install Rsync" spcd_install_package "rsync" From 42f2cf73c52d3d252d7e76dd638d55a7aa43d539 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 6 Aug 2024 19:46:27 +0200 Subject: [PATCH 6/8] upgrade pip --- readme.md | 1 - spcd.sh | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/readme.md b/readme.md index f9c8ffa..2e48fac 100644 --- a/readme.md +++ b/readme.md @@ -85,7 +85,6 @@ from various contexts of CA, CI and OCI / OS. * actions * includes * handle python virtual environment - * upgrade pip * install packages * ruff * relay environment module name diff --git a/spcd.sh b/spcd.sh index 4b169f8..32e98e4 100644 --- a/spcd.sh +++ b/spcd.sh @@ -672,6 +672,8 @@ index-url = ${SPCD_URL_PYTHON} spcd_ip__venv="/opt/venv" "${SPCD_PYTHON_ALIAS}" -m "venv" "${spcd_ip__venv}" . "${spcd_ip__venv}/bin/activate" + spcd_split + pip install --upgrade "pip" # rsync spcd_step "Install Rsync" spcd_install_package "rsync" From dd457b9a8595dcf1c14ee059b02bb959ab15c81b Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 6 Aug 2024 19:48:08 +0200 Subject: [PATCH 7/8] mv venv --- spcd.sh | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/spcd.sh b/spcd.sh index 32e98e4..577b5f5 100644 --- a/spcd.sh +++ b/spcd.sh @@ -654,26 +654,6 @@ spcd_install_packages() { ;; *) ;; esac - # python venv - spcd_step "Install Python virtual environment" - case "${SPCD_OS_ID}" in - "${SPCD_OS_DEBIAN}" | "${SPCD_OS_UBUNTU}") - spcd_install_package "python3-venv" - ;; - # FIXME arch - *) ;; - esac - spcd_split - spcd_write "/etc/pip.conf" "\ -[global] -index-url = ${SPCD_URL_PYTHON} -" - spcd_split - spcd_ip__venv="/opt/venv" - "${SPCD_PYTHON_ALIAS}" -m "venv" "${spcd_ip__venv}" - . "${spcd_ip__venv}/bin/activate" - spcd_split - pip install --upgrade "pip" # rsync spcd_step "Install Rsync" spcd_install_package "rsync" @@ -711,6 +691,26 @@ index-url = ${SPCD_URL_PYTHON} "${SPCD_PM_PACMAN}") spcd_install_package "openssh" ;; *) ;; esac + # venv + spcd_step "Install Python virtual environment" + case "${SPCD_OS_ID}" in + "${SPCD_OS_DEBIAN}" | "${SPCD_OS_UBUNTU}") + spcd_install_package "python3-venv" + ;; + # FIXME arch + *) ;; + esac + spcd_split + spcd_write "/etc/pip.conf" "\ +[global] +index-url = ${SPCD_URL_PYTHON} +" + spcd_split + spcd_ip__venv="/opt/venv" + "${SPCD_PYTHON_ALIAS}" -m "venv" "${spcd_ip__venv}" + . "${spcd_ip__venv}/bin/activate" + spcd_split + pip install --upgrade "pip" } spcd_install_python_modules() { From 0ad80b2761341dd9dc3e1fe1b271015ee94f3170 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Tue, 6 Aug 2024 19:52:01 +0200 Subject: [PATCH 8/8] pip/pelican,ruff,sphinx --- readme.md | 3 --- spcd.sh | 5 +++++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/readme.md b/readme.md index 2e48fac..1c9ea47 100644 --- a/readme.md +++ b/readme.md @@ -84,9 +84,6 @@ from various contexts of CA, CI and OCI / OS. * define templates * actions * includes -* handle python virtual environment - * install packages - * ruff * relay environment module name * write tests diff --git a/spcd.sh b/spcd.sh index 577b5f5..bb9007f 100644 --- a/spcd.sh +++ b/spcd.sh @@ -711,6 +711,11 @@ index-url = ${SPCD_URL_PYTHON} . "${spcd_ip__venv}/bin/activate" spcd_split pip install --upgrade "pip" + spcd_split + pip install \ + "pelican" \ + "ruff" \ + "sphinx" } spcd_install_python_modules() {