Commit 8ac2dee8 authored by Joseph Walton-Rivers's avatar Joseph Walton-Rivers 🍪

code cleanup so tox passes

parent 0d30d686
Pipeline #1269 failed with stage
in 56 seconds
......@@ -2,3 +2,4 @@ __pycache__/
build/
dist/
*.egg-info
.tox/
......@@ -7,7 +7,7 @@ test:
script:
- python setup.py test
- pip install tox flake8 # you can also use tox
- tox -e py36,flake8
- tox
run:
script:
......
# Include the license file
include LICENSE.txt
# Include the data files
recursive-include test *.html
recursive-include test *.py
exclude .gitlab-ci.yml
......@@ -3,7 +3,7 @@
# Based on the setuptools example
##
from setuptools import setup, find_packages
from setuptools import setup
from codecs import open
from os import path
......@@ -13,25 +13,26 @@ here = path.abspath(path.dirname(__file__))
with open(path.join(here, 'README.rst'), encoding='utf-8') as f:
long_description = f.read()
setup(name='j2static',
version='0.1',
description='static templating engine',
long_description=long_description,
author='FOSS Galaxy',
author_email='software@fossgalaxy.com',
url='https://www.fossgalaxy.com',
install_requires=[
'jinja2',
],
classifiers=[
'Development Status :: 3 - Alpha',
'Programming Language :: Python :: 3'
],
packages=['j2static',],
package_dir={'j2static': 'src/j2static'},
entry_points={
setup(
name='j2static',
version='0.1',
description='static templating engine',
long_description=long_description,
author='FOSS Galaxy',
author_email='software@fossgalaxy.com',
url='https://www.fossgalaxy.com',
install_requires=[
'jinja2',
],
classifiers=[
'Development Status :: 3 - Alpha',
'Programming Language :: Python :: 3'
],
packages=['j2static', ],
package_dir={'j2static': 'src/j2static'},
entry_points={
'console_scripts': [
'j2static=j2static:main',
],
},
)
},
)
#! /usr/bin/env python3
TEMPLATE_DIR = "templates"
from jinja2 import Environment, PackageLoader, select_autoescape
TEMPLATE_DIR = "templates"
env = Environment(
loader=PackageLoader('test', TEMPLATE_DIR),
autoescape=select_autoescape(['html', 'xml'])
loader=PackageLoader('test', TEMPLATE_DIR),
autoescape=select_autoescape(['html', 'xml'])
)
def render(name):
template = env.get_template(name)
return template.render()
template = env.get_template(name)
return template.render()
def main():
print("test")
......@@ -2,7 +2,8 @@
##
# Dynamic server mode
#
# This is useful for development because you can see the changes made in real time
# This is useful for development because you can see the changes made
# in real time.
##
import main
......@@ -12,17 +13,19 @@ import socketserver
PORT = 8082
class TemplateHTTPServer(BaseHTTPRequestHandler):
def do_GET(self):
self.send_response(200)
self.send_header('Content-type', 'text/html')
self.end_headers()
data = main.render('index.html')
self.wfile.write(data.encode())
Handler = TemplateHTTPServer
httpd = socketserver.TCPServer( ("", PORT), Handler)
httpd = socketserver.TCPServer(("", PORT), Handler)
httpd.serve_forever()
httpd.close()
<!doctype html>
<html>
<head>
<title></title>
</head>
<body>
{% block content %}
{% endblock %}
</body>
</html>
{% extends "_base.html" %}
{% block content %}test{% endblock %}
# Fake test case to check that tox works
def test_success():
return True
......@@ -11,13 +11,10 @@
# and also to help confirm pull requests to this project.
[tox]
envlist = py{27,34,35,36}
envlist = py36
[testenv]
basepython =
py27: python2.7
py34: python3.4
py35: python3.5
py36: python3.6
deps =
check-manifest
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment