Skip to content

Commit e3e08eb

Browse files
committed
Add tomli import to support python<3.11
1 parent 1fbd5d0 commit e3e08eb

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

babel_runner.py

+9-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,15 @@
66
import subprocess
77
from pathlib import Path
88

9-
import tomllib
9+
try:
10+
import tomllib
11+
except ImportError:
12+
try:
13+
import tomli as tomllib
14+
except ImportError as ie:
15+
raise ImportError(
16+
"tomli or tomllib is required to parse pyproject.toml"
17+
) from ie
1018

1119
PROJECT_DIR = Path(__file__).resolve().parent
1220

requirements.txt

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# for babel_runner.py
2+
setuptools
3+
Babel
4+
Jinja2
5+
tomli; python_version < "3.10"

0 commit comments

Comments
 (0)