comparison roundup/admin.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 087cae2fbcea
children 5ad7fb912227
comparison
equal deleted inserted replaced
6523:49d26e77d173 6524:f961dbbc3573
322 tdir = os.path.join(path, 'share', 'roundup', 'templates') 322 tdir = os.path.join(path, 'share', 'roundup', 'templates')
323 if os.path.isdir(tdir): 323 if os.path.isdir(tdir):
324 templates = init.listTemplates(tdir) 324 templates = init.listTemplates(tdir)
325 break 325 break
326 326
327 # search for data files parallel to the roundup
328 # install dir. E.G. a wheel install
329 # use roundup.__path__ and go up a level then use sys.prefix
330 # to create a base path for searching.
331
332 import roundup, sys
333 # roundup.__path__ should be something like:
334 # /usr/local/lib/python3.10/site-packages/roundup
335 # os.prefix should be /usr, /usr/local or root of virtualenv
336 # strip leading / to make os.path.join work right.
337 tdir = os.path.join(os.path.dirname(roundup.__path__[0]),
338 sys.prefix[1:], 'share', 'roundup', 'templates')
339 if os.path.isdir(tdir):
340 templates.update(init.listTemplates(tdir))
341
327 # OK, now try as if we're in the roundup source distribution 342 # OK, now try as if we're in the roundup source distribution
328 # directory, so this module will be in .../roundup-*/roundup/admin.py 343 # directory, so this module will be in .../roundup-*/roundup/admin.py
329 # and we're interested in the .../roundup-*/ part. 344 # and we're interested in the .../roundup-*/ part.
330 path = __file__ 345 path = __file__
331 for _i in range(2): 346 for _i in range(2):

Roundup Issue Tracker: http://roundup-tracker.org/