Skip to content

Commit 2bd4211

Browse files
committed
add workaround for setup.py importing plover
- use `exec` in `setup.py` - detect `exec` is being used in `plover`, and disable i18n support Note: in this case, we don't want i18n support anyway, since some of the strings we normally translate are used for package metadata.
1 parent dbe8424 commit 2bd4211

File tree

2 files changed

+12
-13
lines changed

2 files changed

+12
-13
lines changed

plover/__init__.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,14 @@
33

44
"""Plover: Open Source Stenography Software"""
55

6-
from plover.i18n import Translator
7-
8-
9-
_ = Translator(__package__)
6+
if __name__ == 'plover':
7+
from plover.i18n import Translator
8+
_ = Translator(__package__)
9+
else:
10+
# exec from `setup.py`, package data
11+
# may not be available, and we don't
12+
# want to translate anyway.
13+
_ = lambda s: s
1014

1115
__version__ = '4.0.0.dev8'
1216
__copyright__ = '(C) Open Steno Project'

setup.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,10 @@
1313

1414
sys.path.insert(0, os.path.dirname(__file__))
1515

16-
from plover import (
17-
__name__ as __software_name__,
18-
__version__,
19-
__description__,
20-
__url__,
21-
__download_url__,
22-
__license__,
23-
__copyright__,
24-
)
16+
__software_name__ = 'plover'
17+
18+
with open(os.path.join(__software_name__, '__init__.py')) as fp:
19+
exec(fp.read())
2520

2621
from plover_build_utils.setup import (
2722
BuildPy, BuildUi, Command, Test, babel_options

0 commit comments

Comments
 (0)