repackage this

this makes the python scripts available as commands
master
nathaniel smith 2017-04-21 21:29:55 -07:00
parent 1b7f68c631
commit b74fdc94e6
4 changed files with 24 additions and 13 deletions

View File

@ -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.

View File

@ -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'
]
},
)

View File

@ -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))

View File

@ -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 <http://datagrok.org>