aboutsummaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorLoic Guegan <manzerbredes@mailbox.org>2020-04-22 07:39:07 +0200
committerLoic Guegan <manzerbredes@mailbox.org>2020-04-22 07:39:07 +0200
commita7217345e1cf9fa878e271fcc199f9a18eb9637f (patch)
tree638d5bcc4e4388ebcb08c9e75ced9d759bb1f3f4 /libs
parent5c0cc8e2f4fd632445079abc7af1b65ca0d3a8e0 (diff)
Debug package
Diffstat (limited to 'libs')
-rw-r--r--libs/__init__.py0
-rw-r--r--libs/args.py9
-rw-r--r--libs/resource.py23
-rw-r--r--libs/theme.py29
4 files changed, 0 insertions, 61 deletions
diff --git a/libs/__init__.py b/libs/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/libs/__init__.py
+++ /dev/null
diff --git a/libs/args.py b/libs/args.py
deleted file mode 100644
index 6ae54bf..0000000
--- a/libs/args.py
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/usr/bin/env python
-
-import argparse
-
-args_parser = argparse.ArgumentParser()
-args_parser.add_argument("resource", help="A JSON resource file.")
-args_parser.add_argument("destination", help="Start page folder name.")
-args = args_parser.parse_args()
-
diff --git a/libs/resource.py b/libs/resource.py
deleted file mode 100644
index f521022..0000000
--- a/libs/resource.py
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/usr/bin/env python
-
-from os import path
-import json, jsonschema
-
-
-class Resource:
- def __init__(self, resource):
- self.resource=resource
- # Read data
- try:
- with open(resource,'r') as f:
- self.data=f.read()
- except IOError:
- print("Unable to found "+resource)
- exit(1)
- # Decode data
- try:
- self.json=json.loads(self.data)
- except:
- print("Unable to read json from "+resource)
- exit(1)
-
diff --git a/libs/theme.py b/libs/theme.py
deleted file mode 100644
index 9859451..0000000
--- a/libs/theme.py
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/usr/bin/env python
-
-from resource import Resource
-from shutil import copytree, ignore_patterns
-from jinja2 import Template
-import os
-
-class Theme:
-
- def __init__(self, path, resource_data):
- res=Resource(path+"/resources.json")
- self.theme_path=path.strip('/')
- self.data=res.json
- self.data.update(resource_data)
- # Read theme
- try:
- with open(path+"/index.html",'r') as f:
- self.template=Template(f.read())
- except IOError:
- print("Unable to found "+resource)
- exit(1)
-
-
- def deploy(self, path):
- copytree(self.theme_path, path, dirs_exist_ok=True,ignore=ignore_patterns("*.json","index.html"))
- themes_dir=os.path.split(self.theme_path)[0]
- theme_dir=os.path.split(self.theme_path)[1]
- with open(path+"/index.html", "w") as index:
- index.write(self.template.render(self.data))