Include static and templates in the built package

This commit is contained in:
Daniel Parks 2017-09-13 11:03:25 -07:00
parent 63f7d12371
commit b96c7a17cf
No known key found for this signature in database
GPG key ID: 7335138B2B9829EB
13 changed files with 9 additions and 3 deletions

View file

@ -1 +1,3 @@
include README.rst
graft infinitory/static
graft infinitory/templates

View file

@ -24,7 +24,10 @@ def output_html(inventory, directory):
if os.path.isdir(directory):
shutil.rmtree(directory)
os.mkdir(directory, 0o755)
shutil.copytree("static", "{}/static".format(directory))
shutil.copytree(
"{}/static".format(os.path.dirname(os.path.abspath(__file__))),
"{}/static".format(directory))
with open("{}/pygments.css".format(directory), "w", encoding="utf-8") as css:
css.write(pygments.formatters.HtmlFormatter().get_style_defs('.codehilite'))
@ -126,8 +129,9 @@ def output_html(inventory, directory):
def render_template(template_name, **kwargs):
data_path = os.path.dirname(os.path.abspath(__file__))
environment = jinja2.Environment(
loader=jinja2.FileSystemLoader("templates"),
loader=jinja2.FileSystemLoader("{}/templates".format(data_path)),
autoescape=jinja2.select_autoescape(default=True))
md = markdown2.Markdown(extras=[

View file

@ -2,7 +2,7 @@ import setuptools
setuptools.setup(
name = "infinitory",
version = "0.0.1",
version = "0.0.2",
description = "SRE host, role, and service inventory",
author = "Daniel Parks",