diff --git a/README.rst b/README.rst index 82cf808..86a98e2 100644 --- a/README.rst +++ b/README.rst @@ -153,3 +153,10 @@ The code is dual-licenced under both - `Apache License, Version 2.0 `_ at your option. + +Supported Python versions +------------------------- + +The versions that are regularly tested can be found `here `_, that's probably Python 3.8 and Python 3.9. + +For your convenience we declare more Python versions acceptable in ``pyproject.toml``, but the non-tested versions could potentially break from time to time. My goal is to support basically Python 3.x; please let me know if something doesn't work on an older version. diff --git a/diff_pdf_visually/__init__.py b/diff_pdf_visually/__init__.py index 0f0ebb5..26afc49 100644 --- a/diff_pdf_visually/__init__.py +++ b/diff_pdf_visually/__init__.py @@ -1,5 +1,5 @@ """ -'Quickly check whether there is a visible difference between two PDFs, using ImageMagick and pdftocairo. +Quickly check whether there is a visible difference between two PDFs, using ImageMagick and pdftocairo. """ __version__ = '1.6.1' diff --git a/diff_pdf_visually/diff.py b/diff_pdf_visually/diff.py index 19dd7c3..90a32b5 100644 --- a/diff_pdf_visually/diff.py +++ b/diff_pdf_visually/diff.py @@ -9,7 +9,7 @@ import os.path, pathlib, subprocess, sys, tempfile, time from concurrent.futures import ThreadPoolExecutor -from contextlib import nullcontext +from .polyfill import nullcontext from .constants import DEFAULT_THRESHOLD, DEFAULT_VERBOSITY, DEFAULT_DPI from .constants import VERB_PRINT_REASON, VERB_PRINT_TMPDIR from .constants import VERB_PERPAGE, VERB_PRINT_CMD, VERB_ROUGH_PROGRESS diff --git a/diff_pdf_visually/polyfill.py b/diff_pdf_visually/polyfill.py new file mode 100644 index 0000000..52cee0e --- /dev/null +++ b/diff_pdf_visually/polyfill.py @@ -0,0 +1,14 @@ +""" +Reimplementations of standard functionality to get better compatibility with older +Python versions. +""" + +class nullcontext: + def __init__(self, enter_result): + self._enter_result = enter_result + + def __enter__(self): + return self._enter_result + + def __exit__(self, exc_type, exc_value, traceback): + pass