Skip to content

Commit b3049fb

Browse files
authored
✨ NEW: add python_install_tk option (#4)
1 parent 1b66927 commit b3049fb

File tree

6 files changed

+45
-4
lines changed

6 files changed

+45
-4
lines changed

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,19 @@ pip install tox
6262
tox
6363
```
6464

65+
For testing specific distributions and python versions, .e.g.:
66+
67+
```bash
68+
MOLECULE_DISTRO=centos8 MOLECULE_PYTHON_VERSION=3.8 tox
69+
```
70+
71+
To manually inspect a container, you can run the converge and destroy steps individually:
72+
73+
```bash
74+
tox converge
75+
tox destroy
76+
```
77+
6578
## Code style
6679

6780
Code style is formatted and linted with [pre-commit](https://pre-commit.com/).

defaults/main.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,6 @@ python_venv_packages:
66
- pip
77
- setuptools
88
- wheel
9+
10+
# Install the Tk GUI toolkit (see https://docs.python.org/3/library/tkinter.html)
11+
python_install_tk: false

molecule/default/converge.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
- name: Converge
22
hosts: all
33

4-
vars:
5-
- run_tests: true
6-
- ansible_python_interpreter: /usr/bin/python3
7-
84
roles:
95
- role: "marvel-nccr.python"

molecule/default/molecule.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,8 @@ provisioner:
3131
hosts:
3232
all:
3333
vars:
34+
ansible_python_interpreter: /usr/bin/python3
3435
python_base_version: "${MOLECULE_PYTHON_VERSION:-3.7}"
3536
python_venv_path: /tmp/test_venv
37+
python_install_tk: true
38+
run_tests: true

tasks/setup-debian.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,15 @@
3030
- name: Install distutils
3131
when: ansible_distribution_major_version|int == 18
3232
become: true
33+
become_user: "{{ root_user }}"
3334
apt:
3435
name:
3536
- python{{ python_base_version }}-distutils
37+
38+
- name: Install Tk GUI toolkit for python{{ python_base_version }}
39+
when: python_install_tk|bool
40+
become: true
41+
become_user: "{{ root_user }}"
42+
apt:
43+
name:
44+
- python{{ python_base_version }}-tk

tasks/setup-redhat.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,20 @@
66
name:
77
- python{{ python_base_version | replace('.', '') }}
88
- wget
9+
10+
- name: install tkinter
11+
when: python_install_tk|bool
12+
block:
13+
- name: Install Tk GUI toolkit for python{{ python_base_version | replace('.', '') }}
14+
become: true
15+
become_user: "{{ root_user }}"
16+
yum:
17+
name:
18+
- python{{ python_base_version | replace('.', '') }}-tkinter # TODO this may not be correct
19+
rescue:
20+
- name: Install Tk GUI toolkit for python3 (fallback)
21+
become: true
22+
become_user: "{{ root_user }}"
23+
yum:
24+
name:
25+
- python3-tkinter

0 commit comments

Comments
 (0)