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__/ ...@@ -2,3 +2,4 @@ __pycache__/
build/ build/
dist/ dist/
*.egg-info *.egg-info
.tox/
...@@ -7,7 +7,7 @@ test: ...@@ -7,7 +7,7 @@ test:
script: script:
- python setup.py test - python setup.py test
- pip install tox flake8 # you can also use tox - pip install tox flake8 # you can also use tox
- tox -e py36,flake8 - tox
run: run:
script: 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 @@ ...@@ -3,7 +3,7 @@
# Based on the setuptools example # Based on the setuptools example
## ##
from setuptools import setup, find_packages from setuptools import setup
from codecs import open from codecs import open
from os import path from os import path
...@@ -13,25 +13,26 @@ here = path.abspath(path.dirname(__file__)) ...@@ -13,25 +13,26 @@ here = path.abspath(path.dirname(__file__))
with open(path.join(here, 'README.rst'), encoding='utf-8') as f: with open(path.join(here, 'README.rst'), encoding='utf-8') as f:
long_description = f.read() long_description = f.read()
setup(name='j2static', setup(
version='0.1', name='j2static',
description='static templating engine', version='0.1',
long_description=long_description, description='static templating engine',
author='FOSS Galaxy', long_description=long_description,
author_email='software@fossgalaxy.com', author='FOSS Galaxy',
url='https://www.fossgalaxy.com', author_email='software@fossgalaxy.com',
install_requires=[ url='https://www.fossgalaxy.com',
'jinja2', install_requires=[
], 'jinja2',
classifiers=[ ],
'Development Status :: 3 - Alpha', classifiers=[
'Programming Language :: Python :: 3' 'Development Status :: 3 - Alpha',
], 'Programming Language :: Python :: 3'
packages=['j2static',], ],
package_dir={'j2static': 'src/j2static'}, packages=['j2static', ],
entry_points={ package_dir={'j2static': 'src/j2static'},
entry_points={
'console_scripts': [ 'console_scripts': [
'j2static=j2static:main', 'j2static=j2static:main',
], ],
}, },
) )
#! /usr/bin/env python3 #! /usr/bin/env python3
TEMPLATE_DIR = "templates"
from jinja2 import Environment, PackageLoader, select_autoescape from jinja2 import Environment, PackageLoader, select_autoescape
TEMPLATE_DIR = "templates"
env = Environment( env = Environment(
loader=PackageLoader('test', TEMPLATE_DIR), loader=PackageLoader('test', TEMPLATE_DIR),
autoescape=select_autoescape(['html', 'xml']) autoescape=select_autoescape(['html', 'xml'])
) )
def render(name): def render(name):
template = env.get_template(name) template = env.get_template(name)
return template.render() return template.render()
def main(): def main():
print("test") print("test")
...@@ -2,7 +2,8 @@ ...@@ -2,7 +2,8 @@
## ##
# Dynamic server mode # 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 import main
...@@ -12,17 +13,19 @@ import socketserver ...@@ -12,17 +13,19 @@ import socketserver
PORT = 8082 PORT = 8082
class TemplateHTTPServer(BaseHTTPRequestHandler): class TemplateHTTPServer(BaseHTTPRequestHandler):
def do_GET(self): def do_GET(self):
self.send_response(200) self.send_response(200)
self.send_header('Content-type', 'text/html') self.send_header('Content-type', 'text/html')
self.end_headers() self.end_headers()
data = main.render('index.html') data = main.render('index.html')
self.wfile.write(data.encode()) self.wfile.write(data.encode())
Handler = TemplateHTTPServer Handler = TemplateHTTPServer
httpd = socketserver.TCPServer( ("", PORT), Handler) httpd = socketserver.TCPServer(("", PORT), Handler)
httpd.serve_forever() httpd.serve_forever()
httpd.close() 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 @@ ...@@ -11,13 +11,10 @@
# and also to help confirm pull requests to this project. # and also to help confirm pull requests to this project.
[tox] [tox]
envlist = py{27,34,35,36} envlist = py36
[testenv] [testenv]
basepython = basepython =
py27: python2.7
py34: python3.4
py35: python3.5
py36: python3.6 py36: python3.6
deps = deps =
check-manifest 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