diff --git a/scripts/generate_home_page.sh b/scripts/generate_home_page.sh index cb771ae..18fb382 100755 --- a/scripts/generate_home_page.sh +++ b/scripts/generate_home_page.sh @@ -1,5 +1,7 @@ #!/bin/bash +# TODO just make this better once the new package is ready + # Feed JSON/tdp output from "stats" into mustache template to generate # tilde.town homepage. Invoke periodically from crontab. diff --git a/setup.py b/setup.py index 721b8fa..14377cc 100644 --- a/setup.py +++ b/setup.py @@ -4,19 +4,25 @@ from setuptools import setup setup( name='tildetown', - version='0.0.2', - description='python stuf for tilde.town', + version='1.0.0', + description='executable scripts used on tildetown', url='https://github.com/tildetown/tildetown-scripts', - author='vilmibm shaksfrpease', - author_email='nks@lambdaphil.es', + author='vilmibm', + author_email='tildetown@protonmail.ch', license='GPL', classifiers=[ - 'Development Status :: 3 - Alpha', + 'Development Status :: 3 - Beta', 'Intended Audience :: Other Audience', 'Topic :: Artistic Software', - 'License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)', + 'License :: OSI Approved :: GNU General Public License v3 (GPLv3)', ], keywords='community', packages=['tildetown'], - install_requires = ['pyhocon==0.3.10', 'sh==1.11', 'Flask==0.10.1', 'requests==2.7.0', 'pystache==0.5.4'], + install_requires = ['pystache==0.5.4'], + entry_points = { + 'console_scripts': [ + 'stats = tildetown.stats:main', + 'mustache = tildetown.mustache:main' + ] + }, ) diff --git a/tildetown/mustache.py b/tildetown/mustache.py index e95a720..be13ea8 100644 --- a/tildetown/mustache.py +++ b/tildetown/mustache.py @@ -1,5 +1,6 @@ -from json import loads -from sys import argv,stdin +#!/usr/bin/env python3 +import json +import sys from pystache import render @@ -14,9 +15,11 @@ def slurp(file_path): pass return contents +def main(argv): + template = slurp(argv[1]) + data = json.loads(sys.stdin.read()) + sys.stdout.write(render(template, data)) if __name__ == '__main__': - template = slurp(argv[1]) - data = loads(stdin.read()) - print(render(template, data)) + exit(main(sys.argv)) diff --git a/tildetown/stats.py b/tildetown/stats.py index 039c81b..c86ef65 100755 --- a/tildetown/stats.py +++ b/tildetown/stats.py @@ -1,4 +1,4 @@ -#!/usr/local/bin/python3 +#!/usr/bin/env python3 # stats.py - tilde data in tilde data protocol format. # Copyright 2015 Michael F. Lamb