Skip to content

Commit 9c5e090

Browse files
Environment option to skip compilation of translation files
1 parent 5c3218d commit 9c5e090

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

README.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ Basic usage
3333
-----------
3434

3535
#. Install app to somewhere on your Python path (e.g. ``pip install
36-
django-linkcheck``).
36+
django-linkcheck``). If you do not need multilingual support, you can skip
37+
the compilation of the translation files with an environment variable, e.g.
38+
(``LINKCHECK_SKIP_TRANSLATIONS=true pip install django-linkcheck``).
3739

3840
#. Add ``'linkcheck'`` to your ``settings.INSTALLED_APPS``.
3941

linkcheck/build_meta.py

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,34 @@
1+
import os
12
import subprocess
23

34
from setuptools import build_meta as default
45
from setuptools.build_meta import * # noqa: F401, F403
56

67

78
def compile_translation_files():
8-
print("Compile translation files")
9+
print("Compiling translation files...")
910
subprocess.run(["django-admin", "compilemessages"], cwd="linkcheck")
1011

1112

13+
def should_compile_translation_files():
14+
skip_translations = os.environ.get("LINKCHECK_SKIP_TRANSLATIONS")
15+
if skip_translations and skip_translations.lower() in ("1", "true", "yes", "t", "y"):
16+
return False
17+
18+
return True
19+
20+
1221
def build_sdist(sdist_directory, config_settings=None):
13-
compile_translation_files()
22+
if should_compile_translation_files():
23+
compile_translation_files()
24+
1425
return default.build_sdist(sdist_directory, config_settings)
1526

1627

1728
def build_wheel(wheel_directory, config_settings=None, metadata_directory=None):
18-
compile_translation_files()
29+
if should_compile_translation_files():
30+
compile_translation_files()
31+
1932
return default.build_wheel(
2033
wheel_directory,
2134
config_settings=config_settings,

0 commit comments

Comments
 (0)