From 310d59cce2904c25d47577d1fa0f473b82864764 Mon Sep 17 00:00:00 2001 From: Adrien Beudin Date: Mon, 22 Feb 2016 18:56:26 +0100 Subject: [PATCH 1/3] update setup.py --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index b30e664..e514bc7 100644 --- a/setup.py +++ b/setup.py @@ -30,6 +30,6 @@ setup(name='prosopopee', keywords='', include_package_data=True, package_data={ - 'prosopopee': ["themes/*/*/*/*"] + ["static/%s/*" % x for x in os.listdir("./prosopopee/static/")] + ['templates/*.html', 'templates/sections/*'], + 'prosopopee': ['themes/*/*/*/*'] + ['themes/*/templates/*.html'] + ['themes/*/templates/section/*.html'] }, ) From ce97f7c18ab8c2f0b264bd1910cc310b11437810 Mon Sep 17 00:00:00 2001 From: Adrien Beudin Date: Mon, 22 Feb 2016 18:57:00 +0100 Subject: [PATCH 2/3] update MANIFEST.in --- MANIFEST.in | 2 -- 1 file changed, 2 deletions(-) diff --git a/MANIFEST.in b/MANIFEST.in index 3adf836..5a926f8 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,4 +1,2 @@ -recursive-include templates * -recursive-include static * recursive-include themes * include requirements.txt From d6ca3b41c0a7bdb09fc61f2d006e5e432e14b95c Mon Sep 17 00:00:00 2001 From: Adrien Beudin Date: Mon, 22 Feb 2016 19:02:49 +0100 Subject: [PATCH 3/3] update prosopopee.py after revert --- prosopopee/prosopopee.py | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/prosopopee/prosopopee.py b/prosopopee/prosopopee.py index 4021661..6d849ca 100644 --- a/prosopopee/prosopopee.py +++ b/prosopopee/prosopopee.py @@ -10,11 +10,6 @@ from jinja2 import Environment, FileSystemLoader from .cache import CACHE from .utils import error -templates = Environment(loader=FileSystemLoader([os.path.realpath(os.path.join(os.getcwd(), "templates")), os.path.join(os.path.split(os.path.realpath(__file__))[0], "templates")])) -index_template = templates.get_template("index.html") -gallery_index_template = templates.get_template("gallery-index.html") -page_template = templates.get_template("page.html") - SETTINGS = { "show_date": True, "gm": { @@ -118,19 +113,21 @@ def main(): # XXX recursively merge directories if os.path.exists(os.path.join(os.getcwd(), "build", "static")): shutil.rmtree(os.path.join(os.getcwd(), "build", "static")) - if settings.get("theme"): - if os.path.exists(os.path.join(os.getcwd(), "templates")): - shutil.rmtree(os.path.join(os.getcwd(), "templates")) - shutil.copytree(os.path.join(os.path.split(os.path.realpath(__file__))[0], "themes", settings.get("theme"), "static"), os.path.join(os.getcwd(), "build", "static")) - shutil.copytree(os.path.join(os.path.split(os.path.realpath(__file__))[0], "themes", settings.get("theme"), "templates"), os.path.join(os.getcwd(), "templates")) - templates = Environment(loader=FileSystemLoader([os.path.realpath(os.path.join(os.getcwd(), "templates")), os.path.join(os.path.split(os.path.realpath(__file__))[0], "templates")])) - index_template = templates.get_template("index.html") - gallery_index_template = templates.get_template("gallery-index.html") - page_template = templates.get_template("page.html") - elif os.path.exists(os.path.join(os.getcwd(), "static")): + + if settings.get("theme") is None: + gallery_theme = "exposure" + else: + gallery_theme = settings.get("theme") + + if os.path.exists(os.path.join(os.getcwd(), "static")): shutil.copytree(os.path.join(os.getcwd(), "static"), os.path.join(os.getcwd(), "build", "static")) else: - shutil.copytree(os.path.join(os.path.split(os.path.realpath(__file__))[0], "static"), os.path.join(os.getcwd(), "build", "static")) + shutil.copytree(os.path.join(os.path.split(os.path.realpath(__file__))[0], "themes", gallery_theme, "static"), os.path.join(os.getcwd(), "build", "static")) + + templates = Environment(loader=FileSystemLoader([os.path.realpath(os.path.join(os.getcwd(), "templates")), os.path.join(os.path.split(os.path.realpath(__file__))[0], "themes", gallery_theme, "templates")])) + index_template = templates.get_template("index.html") + gallery_index_template = templates.get_template("gallery-index.html") + page_template = templates.get_template("page.html") for gallery in dirs: gallery_settings = yaml.safe_load(open(os.path.join(os.getcwd(), gallery, "settings.yaml"), "r"))