diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2d7165e..fee38b6 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -93,7 +93,7 @@ build_debian: - gzip -9n package/debian/matemat/usr/share/doc/matemat/changelog - cp -r static/ package/debian/matemat/usr/lib/matemat/static/ - cp -r templates/ package/debian/matemat/usr/lib/matemat/templates/ - - mkdir -p package/debian/matemat/var/lib/matemat/ + - mkdir -p package/debian/matemat/var/lib/matemat/themes/ - cp -r themes/ package/debian/matemat/usr/lib/matemat/themes/ - python3.7 setup.py egg_info install --root=package/debian/matemat/ --prefix=/usr --optimize=1 - cd package/debian diff --git a/CHANGELOG.md b/CHANGELOG.md index d3321c0..65aebfb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,18 @@ # Matemat Changelog + +## Version 0.3.3 + +Multiple theme search paths + +### Changes + + +- Support for multiple theme search paths + + + + ## Version 0.3.2 diff --git a/matemat/__init__.py b/matemat/__init__.py index 8299a60..2fd20b5 100644 --- a/matemat/__init__.py +++ b/matemat/__init__.py @@ -1,2 +1,2 @@ -__version__ = '0.3.2' +__version__ = '0.3.3' diff --git a/matemat/__main__.py b/matemat/__main__.py index 48fda2a..0839f93 100644 --- a/matemat/__main__.py +++ b/matemat/__main__.py @@ -1,6 +1,7 @@ import logging from typing import Any, Dict, Iterable, Union +import shlex import sys import os.path import bottle @@ -63,11 +64,15 @@ def _init(config: Dict[str, Any]): @bottle.route('/static/') def serve_static_files(filename: str): config = get_config() - themeroot = os.path.abspath(os.path.join(config['themeroot'], config['theme'], 'static')) - staticroot = os.path.abspath(config['staticroot']) - resp = bottle.static_file(filename, root=themeroot) - if resp.status_code == 404: - resp = bottle.static_file(filename, root=staticroot) + roots = [] + for themeroot in shlex.split(config['themeroot']): + roots.append(os.path.abspath(os.path.join(themeroot, config['theme'], 'static'))) + roots.append(os.path.abspath(config['staticroot'])) + resp = None + for root in roots: + resp = bottle.static_file(filename, root=root) + if resp.status_code == 200: + break return resp diff --git a/package/debian/matemat/DEBIAN/control b/package/debian/matemat/DEBIAN/control index 9204d2a..ad71767 100644 --- a/package/debian/matemat/DEBIAN/control +++ b/package/debian/matemat/DEBIAN/control @@ -1,5 +1,5 @@ Package: matemat -Version: 0.3.2 +Version: 0.3.3 Maintainer: s3lph <1375407-s3lph@users.noreply.gitlab.com> Section: web Priority: optional diff --git a/package/debian/matemat/usr/lib/matemat/matemat.conf b/package/debian/matemat/usr/lib/matemat/matemat.conf index 876c9cc..ba13e4c 100644 --- a/package/debian/matemat/usr/lib/matemat/matemat.conf +++ b/package/debian/matemat/usr/lib/matemat/matemat.conf @@ -2,7 +2,7 @@ StaticPath=/usr/lib/matemat/static TemplatePath=/usr/lib/matemat/templates -ThemePath=/var/lib/matemat/themes +ThemePath=/var/lib/matemat/themes /usr/lib/matemat/themes LogTarget=stdout