From 8afa0827085ec6e347ba7c82635badb1a67ae97d Mon Sep 17 00:00:00 2001 From: Yohann D'ANELLO Date: Sun, 20 Dec 2020 17:54:33 +0100 Subject: [PATCH] Add Python 3.6 and 3.10 support, fixes #53 --- .gitlab-ci.yml | 51 +++++++++++++++++++++++++------ squirrelbattle/display/display.py | 3 ++ 2 files changed, 44 insertions(+), 10 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ff5c142..602bc97 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -3,21 +3,16 @@ stages: - quality-assurance - build -py37: - stage: test - image: python:3.7-alpine - before_script: - - apk add --no-cache gettext - - pip install tox - script: tox -e py3 -py38: +py310: stage: test - image: python:3.8-alpine + image: python:rc-alpine before_script: - apk add --no-cache gettext - pip install tox script: tox -e py3 + only: + - master py39: @@ -28,6 +23,38 @@ py39: - pip install tox script: tox -e py3 + +py38: + stage: test + image: python:3.8-alpine + before_script: + - apk add --no-cache gettext + - pip install tox + script: tox -e py3 + + +py37: + stage: test + image: python:3.7-alpine + before_script: + - apk add --no-cache gettext + - pip install tox + script: tox -e py3 + only: + - master + + +py36: + stage: test + image: python:3.6-alpine + before_script: + - apk add --no-cache gettext + - pip install tox + script: tox -e py3 + only: + - master + + linters: stage: quality-assurance image: python:3-alpine @@ -36,11 +63,15 @@ linters: script: tox -e linters allow_failure: true + build-deb: image: debian:buster-slim stage: build before_script: - - apt-get update && apt-get -y --no-install-recommends install build-essential debmake dh-python debhelper gettext python3-all python3-setuptools + - > + apt-get update && apt-get -y --no-install-recommends install + build-essential debmake dh-python debhelper gettext python3-all + python3-setuptools script: - dpkg-buildpackage - mkdir build && cp ../*.deb build/ diff --git a/squirrelbattle/display/display.py b/squirrelbattle/display/display.py index 6257427..a7a900d 100644 --- a/squirrelbattle/display/display.py +++ b/squirrelbattle/display/display.py @@ -2,6 +2,7 @@ # SPDX-License-Identifier: GPL-3.0-or-later import curses +import sys from typing import Any, Optional, Tuple, Union from squirrelbattle.display.texturepack import TexturePack @@ -97,6 +98,8 @@ class Display: attr |= curses.A_BOLD if bold else 0 attr |= curses.A_DIM if dim else 0 attr |= curses.A_INVIS if invis else 0 + # Italic is supported since Python 3.7 + italic &= sys.version_info >= (3, 7,) attr |= curses.A_ITALIC if italic else 0 attr |= curses.A_NORMAL if normal else 0 attr |= curses.A_PROTECT if protect else 0