Mercurial > p > roundup > code
diff roundup/i18n.py @ 6524:f961dbbc3573
issue2551167 roundup issues when using pip install
Running pip install generates a wheel install. This places locale,
template and man pages under site-packages/usr/share/....
These changes make roundup look there for templates (affecting
admin.py) and locale (affecting i18n.py) files. This also makes it
work better in virtual environment and containers (docker).
There is also a commented out bit of code in setup.py that prevents it
from making a bdist_wheel forcing a regular install with files put
under /usr/locale etc. This can be re-enabled if needed for 2.2 if
there are still issues with roundup that aren't solved by then.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Sun, 07 Nov 2021 01:49:03 -0400 |
| parents | 808f7a8ed2b6 |
| children | 5ad7fb912227 |
line wrap: on
line diff
--- a/roundup/i18n.py Sat Nov 06 15:29:24 2021 -0400 +++ b/roundup/i18n.py Sun Nov 07 01:49:03 2021 -0400 @@ -58,6 +58,19 @@ LOCALE_DIRS.append(_mo_path) del _mo_path +# find path when locale files are installed as part of a wheel +# roundup.__path__ should be something like: +# /usr/local/lib/python3.10/site-packages/roundup +# os.prefix should be /usr, /usr/local or root of virtualenv +# strip leading / to make os.path.join work right. +import roundup, sys +_ldir = os.path.join( + os.path.dirname(roundup.__path__[0]), + sys.prefix[1:], 'share', 'locale') +if os.path.isdir(_ldir): + LOCALE_DIRS.append(_ldir) +del _ldir + # Roundup text domain DOMAIN = "roundup"
