-
-
Notifications
You must be signed in to change notification settings - Fork 131
Expand file tree
/
Copy pathsetup.py
More file actions
32 lines (23 loc) · 724 Bytes
/
Copy pathsetup.py
File metadata and controls
32 lines (23 loc) · 724 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import sys
from pathlib import Path
from setuptools import setup
from setuptools.command.build import build as _build
from setuptools.command.sdist import sdist as _sdist
sys.path.insert(0, str(Path(__file__).resolve().parent))
from tools.i18n.compile_translations import main as compile_translations
class BuildWithTranslations(_build):
"""Run compile_translations before standard build."""
def run(self) -> None:
compile_translations()
super().run()
class SdistWithTranslations(_sdist):
"""Ensure translations are compiled in sdist tarball."""
def run(self) -> None:
compile_translations()
super().run()
_ = setup(
cmdclass={
"build": BuildWithTranslations,
"sdist": SdistWithTranslations,
},
)