From: "Sam James" <sam@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/portage:master commit in: .builds/
Date: Fri, 7 Apr 2023 09:52:39 +0000 (UTC) [thread overview]
Message-ID: <1680860999.9dca151ad11df75a1842afd2bee9bad9c9ee0c37.sam@gentoo> (raw)
commit: 9dca151ad11df75a1842afd2bee9bad9c9ee0c37
Author: Oskari Pirhonen <xxc3ncoredxx <AT> gmail <DOT> com>
AuthorDate: Thu Mar 30 04:53:51 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Apr 7 09:49:59 2023 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=9dca151a
ci: NIH actions/setup-python for sourcehut
Use the deadsnakes PPA and PYTHON_VERSIONS env var to control which
version of python get installed. Use a separate setup-python script in
.builds/ to avoid duplicate code. And having to remember to update it in
more than one place for changes.
Signed-off-by: Oskari Pirhonen <xxc3ncoredxx <AT> gmail.com>
Signed-off-by: Sam James <sam <AT> gentoo.org>
.builds/lint.yml | 23 +++++++++++++++++------
.builds/setup-python.sh | 23 +++++++++++++++++++++++
2 files changed, 40 insertions(+), 6 deletions(-)
diff --git a/.builds/lint.yml b/.builds/lint.yml
index a294a3ad6..675fde757 100644
--- a/.builds/lint.yml
+++ b/.builds/lint.yml
@@ -1,15 +1,25 @@
# Maintainer: Oskari Pirhonen <xxc3ncoredxx@gmail.com>
-image: ubuntu/lts
+image: ubuntu/jammy
shell: true
+repositories:
+ # For more versions than just the default python3
+ deadsnakes: https://ppa.launchpadcontent.net/deadsnakes/ppa/ubuntu jammy main "BA6932366A755776"
+environment:
+ PYTHON_VERSIONS:
+ - '3.7'
+ - '3.8'
+ - '3.9'
+ - '3.10'
+ - '3.11'
tasks:
- - setup-lint-env: |
- sudo apt-get update
- sudo apt-get install -y --no-install-recommends python-is-python3 python3-venv
- python -m venv .venv
+ - setup-python: |
+ portage/.builds/setup-python.sh "${PYTHON_VERSIONS[@]}"
+
+ - setup-black: |
source .venv/bin/activate
- pip install --upgrade pip
pip install black
+ deactivate
- black: |
source .venv/bin/activate
@@ -18,3 +28,4 @@ tasks:
xargs grep -l '#!/usr/bin/env python' | \
tr '\n' ' ')"
black --check --diff --color . $STRAGGLERS
+ deactivate
diff --git a/.builds/setup-python.sh b/.builds/setup-python.sh
new file mode 100755
index 000000000..be113ce8e
--- /dev/null
+++ b/.builds/setup-python.sh
@@ -0,0 +1,23 @@
+#!/usr/bin/env bash
+# Maintainer: Oskari Pirhonen <xxc3ncoredxx@gmail.com>
+
+set -ex
+
+install_versions=( "${@/#/python}" )
+
+sudo apt-get install -y --no-install-recommends \
+ python-is-python3 \
+ "${install_versions[@]}" \
+ "${install_versions[@]/%/-venv}"
+
+for py in "${@}"; do
+ "python$py" -m venv ".venv-$py"
+ source ".venv-$py/bin/activate"
+ pip install --upgrade pip
+ deactivate
+done
+
+python -m venv .venv
+source .venv/bin/activate
+pip install --upgrade pip
+deactivate
next reply other threads:[~2023-04-07 9:52 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-07 9:52 Sam James [this message]
-- strict thread matches above, loose matches on Subject: below --
2023-11-11 2:55 [gentoo-commits] proj/portage:master commit in: .builds/ Sam James
2023-11-11 2:55 Sam James
2023-11-11 2:55 Sam James
2023-11-11 2:55 Sam James
2023-07-09 0:35 Sam James
2023-04-07 9:52 Sam James
2023-04-07 9:52 Sam James
2023-04-07 9:52 Sam James
2023-04-07 9:52 Sam James
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1680860999.9dca151ad11df75a1842afd2bee9bad9c9ee0c37.sam@gentoo \
--to=sam@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox