diff --git a/README.rst b/README.rst index 4b9163f..7e686ec 100644 --- a/README.rst +++ b/README.rst @@ -33,7 +33,9 @@ Basic usage ----------- #. Install app to somewhere on your Python path (e.g. ``pip install - django-linkcheck``). + django-linkcheck``). If you do not need multilingual support, you can skip + the compilation of the translation files with an environment variable, e.g. + (``LINKCHECK_SKIP_TRANSLATIONS=true pip install django-linkcheck``). #. Add ``'linkcheck'`` to your ``settings.INSTALLED_APPS``. diff --git a/linkcheck/build_meta.py b/linkcheck/build_meta.py index 435f55d..a75ee56 100644 --- a/linkcheck/build_meta.py +++ b/linkcheck/build_meta.py @@ -1,3 +1,4 @@ +import os import subprocess from setuptools import build_meta as default @@ -5,17 +6,29 @@ def compile_translation_files(): - print("Compile translation files") + print("Compiling translation files...") subprocess.run(["django-admin", "compilemessages"], cwd="linkcheck") +def should_compile_translation_files(): + skip_translations = os.environ.get("LINKCHECK_SKIP_TRANSLATIONS") + if skip_translations and skip_translations.lower() in ("1", "true", "yes", "t", "y"): + return False + + return True + + def build_sdist(sdist_directory, config_settings=None): - compile_translation_files() + if should_compile_translation_files(): + compile_translation_files() + return default.build_sdist(sdist_directory, config_settings) def build_wheel(wheel_directory, config_settings=None, metadata_directory=None): - compile_translation_files() + if should_compile_translation_files(): + compile_translation_files() + return default.build_wheel( wheel_directory, config_settings=config_settings, diff --git a/linkcheck/templates/linkcheck/report.html b/linkcheck/templates/linkcheck/report.html index a65d577..1734170 100644 --- a/linkcheck/templates/linkcheck/report.html +++ b/linkcheck/templates/linkcheck/report.html @@ -171,7 +171,7 @@