-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Download and setup redistributable Python Interpreter from https://github.com/indygreg/python-build-standalone/ if needed ;)
- Loading branch information
Showing
10 changed files
with
630 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: setup-python | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
python-version: ["3.12", "3.11", "3.10", "3.9"] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: 'Set up Python ${{ matrix.python-version }}' | ||
uses: actions/setup-python@v5 | ||
# https://github.com/marketplace/actions/setup-python | ||
with: | ||
python-version: '${{ matrix.python-version }}' | ||
|
||
- name: 'Just call --help with Python v${{ matrix.python-version }}' | ||
run: | | ||
python3 manageprojects/setup_python.py --help | ||
- name: 'Call setup python script with Python v${{ matrix.python-version }}' | ||
env: | ||
PYTHONUNBUFFERED: 1 | ||
PYTHONWARNINGS: always | ||
run: | | ||
sudo python3 manageprojects/setup_python.py -vv | ||
- name: 'Test the installed interpreter' | ||
run: | | ||
$(python3 manageprojects/setup_python.py) -VV |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# Boot Redistributable Python | ||
|
||
TODO: Write Docs ;) | ||
|
||
## CLI | ||
|
||
The CLI interface looks like e.g.: | ||
|
||
```shell | ||
$ python3 setup_python.py --help | ||
|
||
usage: setup_python.py [-h] [-v] [--skip-temp-deletion] [--force-update] [major_version] | ||
|
||
Download and setup redistributable Python Interpreter from https://github.com/indygreg/python-build-standalone/ if | ||
needed ;) | ||
|
||
positional arguments: | ||
major_version Specify the Python version like: 3.10, 3.11, 3.12, ... (default: 3.12) | ||
|
||
options: | ||
-h, --help show this help message and exit | ||
-v, --verbose Increase verbosity level (can be used multiple times, e.g.: -vv) (default: 0) | ||
--skip-temp-deletion Skip deletion of temporary files (default: False) | ||
--force-update Update local Python interpreter, even if it is up-to-date (default: False) | ||
|
||
``` | ||
## Workflow - 1. Check system Python | ||
If the system Python is the same major version as the required Python, we skip the download. | ||
The script just returns the path to the system Python interpreter. | ||
A local installed interpreter (e.g. in ~/.local) will be auto updated. | ||
## Workflow - 7. print the path | ||
If no errors occurred, the path to the Python interpreter will be printed to `stdout`. | ||
So it's usable in shell scripts, like: | ||
```shell | ||
#!/usr/bin/env sh | ||
set -e | ||
PY_313_BIN=$(python3 setup_python.py -v 3.13) | ||
echo "Python 3.13 used from: '${PY_313_BIN}'" | ||
set -x | ||
${PY_313_BIN} -VV | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.