Skip to content

Commit

Permalink
Add tk installation option
Browse files Browse the repository at this point in the history
  • Loading branch information
sco1 committed Sep 5, 2024
1 parent 46e471f commit 1a9ece5
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 2 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,16 @@ jobs:
- {python: '3.7', debug: true, nogil: false}
- {python: '3.12-dev', debug: false, nogil: false}
- {python: '3.13-dev', debug: false, nogil: true}
- {python: '3.13-dev', debug: false, nogil: false, tk: true}
steps:
- uses: actions/checkout@v4
- uses: ./.
with:
python-version: ${{ matrix.python }}
debug: ${{ matrix.debug }}
nogil: ${{ matrix.nogil }}
tk: ${{ matrix.tk }}

- name: check tk
if: matrix.tk
run: python -c 'import tkinter'
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,9 @@ The `nogil` input can be used instead of `debug` to install an *experimental*
free-threaded build of the selected Python version, by adding `nogil: true`
Only available for Python 3.13 and later.

The action's `tk` input can be used to install Tkinter, which is not included
by default. If `debug` is set then `tk-dbg` will be used. If `nogil` is set
then `tk-nogil` will be used; only available for Python 3.13 and later.

[available nightly versions]: https://launchpad.net/~deadsnakes/+archive/ubuntu/nightly/+packages
[available versions]: https://launchpad.net/~deadsnakes/+archive/ubuntu/ppa/+packages
8 changes: 6 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,13 @@ inputs:
description: use free-threaded version of python
required: false
default: false
tk:
description: include Tkinter
required: false
default: false
runs:
using: composite
steps:
- name: add deadsnakes ppa and install ${{ inputs.python-version }} ${{ inputs.debug == 'true' && '(debug)' || '' }}
run: ${{ github.action_path }}/bin/install-python ${{ inputs.python-version }} ${{ inputs.debug == 'true' && '--debug' || '' }} ${{ inputs.nogil == 'true' && '--nogil' || '' }}
- name: add deadsnakes ppa and install ${{ inputs.python-version }} ${{ inputs.debug == 'true' && '(debug)' || '' }} ${{ inputs.tk == 'true' && '(tk)' || '' }}
run: ${{ github.action_path }}/bin/install-python ${{ inputs.python-version }} ${{ inputs.debug == 'true' && '--debug' || '' }} ${{ inputs.nogil == 'true' && '--nogil' || '' }} ${{ inputs.tk == 'true' && '--tk' || '' }}
shell: bash
8 changes: 8 additions & 0 deletions bin/install-python
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ def main() -> int:
mut = parser.add_mutually_exclusive_group()
mut.add_argument('--debug', action='store_true')
mut.add_argument('--nogil', action='store_true')
parser.add_argument('--tk', action='store_true')
args = parser.parse_args()

if args.version.endswith('-dev'):
Expand All @@ -62,6 +63,13 @@ def main() -> int:
py_executable = f'{py}-nogil'
else:
py_executable = py
if args.tk:
if args.debug:
packages.append(f'{py}-tk-dbg')
elif args.nogil:
packages.append(f'{py}-tk-nogil')
else:
packages.append(f'{py}-tk')

envdir = os.path.expanduser(f'~/venv-{version}')
bindir = os.path.join(envdir, 'bin')
Expand Down

0 comments on commit 1a9ece5

Please sign in to comment.