Skip to content

Commit

Permalink
Require python3 in code
Browse files Browse the repository at this point in the history
  • Loading branch information
swalkinshaw committed Feb 20, 2022
1 parent f931c89 commit f409fe3
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/trellis/plugins/vars/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from ansible.errors import AnsibleError
from distutils.version import LooseVersion
from operator import eq, ge, gt
from sys import version_info
from platform import python_version, python_version_tuple

try:
from __main__ import display
Expand All @@ -13,6 +13,11 @@
version_requirement = '2.10.0'
version_tested_max = '2.10.16'

if python_version_tuple()[0] == '2':
raise AnsibleError(('Trellis no longer supports Python 2 (you are using version {}).'
' Python 2 reached end of life in 2020 and is unmaintained.\n'
'Python 3 is required as of Trellis version v1.15.0.').format(python_version()))

if not ge(LooseVersion(__version__), LooseVersion(version_requirement)):
raise AnsibleError(('Trellis no longer supports Ansible {}.\n'
'Please upgrade to Ansible {} or higher.').format(__version__, version_requirement))
Expand Down

0 comments on commit f409fe3

Please sign in to comment.