forked from Katzmann1983/pytr
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py
More file actions
22 lines (18 loc) · 669 Bytes
/
setup.py
File metadata and controls
22 lines (18 loc) · 669 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import os
import subprocess
from setuptools import setup
from setuptools.command.build_py import build_py
class BuildWithCompile(build_py):
def run(self):
locale_dir = os.path.abspath("pytr/locale")
if not os.path.exists(locale_dir):
raise FileNotFoundError(
f"The locale directory '{locale_dir}' does not exist."
)
try:
subprocess.check_call(["pybabel", "compile", "-d", locale_dir])
except subprocess.CalledProcessError as e:
print(f"Error while compiling catalog: {e}")
raise
build_py.run(self)
setup(cmdclass={"build_py": BuildWithCompile})