Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tk installation option #144

Merged
merged 1 commit into from
Sep 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would just add one more, there's no need to test the cross product

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)' || '' }}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you want nogil in here too?

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