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

Allow installation of debug version of Python #18

Merged
merged 1 commit into from
Dec 26, 2020
Merged
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
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -33,6 +33,7 @@ jobs:
if: endsWith(matrix.python-version, '-dev')
with:
python-version: ${{ matrix.python-version }}
# debug: true # Optional, to select a Python debug build
- run: python --version --version && which python
```

@@ -43,6 +44,9 @@ jobs:
- to use tagged builds, just use the version number
- [available versions]

In either case, the actions's `debug` input can be used to install a
debug build of the selected Python version.

note: this action is incompatible with ubuntu-16.04 due to a limitation in
`add-apt-repository`

8 changes: 6 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
@@ -4,9 +4,13 @@ inputs:
python-version:
description: python version to use, such as '3.9'
required: true
debug:
description: use debug version of python
required: false
default: false
runs:
using: composite
steps:
- name: add deadsnakes ppa and install ${{ inputs.python-version }}
run: ${{ github.action_path }}/bin/install-python ${{ inputs.python-version }}
- name: add deadsnakes ppa and install ${{ inputs.python-version }} ${{ inputs.debug && '(debug)' || '' }}
run: ${{ github.action_path }}/bin/install-python ${{ inputs.python-version }} ${{ inputs.debug && '--debug' || '' }}
shell: bash
8 changes: 6 additions & 2 deletions bin/install-python
Original file line number Diff line number Diff line change
@@ -36,6 +36,7 @@ def _print_call(*args: str) -> int:
def main() -> int:
parser = argparse.ArgumentParser()
parser.add_argument('version')
parser.add_argument('--debug', action='store_true')
args = parser.parse_args()

if args.version.endswith('-dev'):
@@ -51,10 +52,13 @@ def main() -> int:
packages.append(f'{py}-distutils')
else:
packages.append('python3-distutils')
if args.debug:
packages.append(f'{py}-dbg')

envdir = os.path.expanduser(f'~/venv-{version}')
bindir = os.path.join(envdir, 'bin')
pip = os.path.join(bindir, 'pip')
py_executable = f'{py}-dbg' if args.debug else py

groups = (
Group.make(
@@ -69,8 +73,8 @@ def main() -> int:
),
),
Group.make(
f'set up {py} environment',
(py, '-mvenv', envdir),
f'set up {py_executable} environment',
(py_executable, '-mvenv', envdir),
(pip, 'install', '--upgrade', 'pip', 'setuptools', 'wheel'),
),
)