aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorficus <ficus@robocracy.org>2012-09-15 22:50:14 +0200
committerficus <ficus@robocracy.org>2012-09-15 22:50:14 +0200
commitced83335a5a338cb9c24956b96da526465d94df8 (patch)
treeb345cd21dfcbb9e660aceb2433c92bd50848938f
parent57a1e70dee45f5cd9493d6d23f8fc7b6435d5388 (diff)
downloadtui-ced83335a5a338cb9c24956b96da526465d94df8.tar.gz
tui-ced83335a5a338cb9c24956b96da526465d94df8.zip
refactor to distributable format
-rw-r--r--.gitignore3
-rw-r--r--MANIFEST.in2
-rw-r--r--README13
-rw-r--r--TODO4
-rw-r--r--helpers/__init__.py1
-rwxr-xr-xrunserver.py7
-rwxr-xr-xsetup.py22
-rw-r--r--torouterui/__init__.py4
-rw-r--r--torouterui/netif.py (renamed from helpers/netif.py)0
-rw-r--r--torouterui/server.py13
-rw-r--r--torouterui/static/css/bootstrap.min.css (renamed from static/css/bootstrap.min.css)0
-rw-r--r--torouterui/static/favicon.ico (renamed from static/favicon.ico)0
-rw-r--r--torouterui/static/img/glyphicons-halflings-white.png (renamed from static/img/glyphicons-halflings-white.png)bin8777 -> 8777 bytes
-rw-r--r--torouterui/static/img/glyphicons-halflings.png (renamed from static/img/glyphicons-halflings.png)bin12799 -> 12799 bytes
-rw-r--r--torouterui/static/robots.txt (renamed from static/robots.txt)0
-rw-r--r--torouterui/sysstatus.py (renamed from helpers/sysstatus.py)0
-rw-r--r--torouterui/templates/base.html (renamed from templates/base.html)0
-rw-r--r--torouterui/templates/home.html (renamed from templates/home.html)0
-rw-r--r--torouterui/templates/lan.html (renamed from templates/lan.html)0
-rw-r--r--torouterui/templates/lib.html (renamed from templates/lib.html)0
-rw-r--r--torouterui/templates/logs.html (renamed from templates/logs.html)0
-rw-r--r--torouterui/templates/processes.html (renamed from templates/processes.html)0
-rw-r--r--torouterui/templates/reboot.html (renamed from templates/reboot.html)0
-rw-r--r--torouterui/templates/tor.html (renamed from templates/tor.html)0
-rw-r--r--torouterui/templates/wan.html (renamed from templates/wan.html)0
-rw-r--r--torouterui/templates/wifi.html (renamed from templates/wifi.html)0
-rw-r--r--torouterui/tor.py (renamed from helpers/tor.py)0
-rw-r--r--torouterui/util.py (renamed from helpers/util.py)0
-rw-r--r--[-rwxr-xr-x]torouterui/views.py (renamed from torouterui.py)19
29 files changed, 68 insertions, 20 deletions
diff --git a/.gitignore b/.gitignore
index f466019..0ab2549 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,3 +6,6 @@
.*
*.tmp
*.old
+build
+dist
+*.egg-info
diff --git a/MANIFEST.in b/MANIFEST.in
new file mode 100644
index 0000000..398e3f9
--- /dev/null
+++ b/MANIFEST.in
@@ -0,0 +1,2 @@
+recursive-include torouterui/templates *
+recursive-include torouterui/static *
diff --git a/README b/README
index cfa23be..fdc6934 100644
--- a/README
+++ b/README
@@ -20,7 +20,7 @@ services and daemons. It is writen in python.
- no cookies, sessions, or server-side state
- compatible with lynx
-### Dependancies
+### Dependencies
- Augueas config file editing library, plus python bindings.
- The Flask lightweight pythonic web framework
@@ -34,12 +34,19 @@ The bundled CSS and image files are Twitter Bootstrap.
### Development
-To resolve dependancies on debian-based systems (wheezy or newer?):
+To resolve dependencies on debian-based systems (wheezy or newer?):
$ sudo apt-get install python-flask python-augeas ifupdown iw
You can run try running the UI on any old Linux machine, just don't submit any
forms unless you want your network configuration clobbered:
- $ ./torouterui.py --debug
+ $ ./runserver.py --debug
+
+### Install
+
+You probably want to either install a .deb package or do some virtualenv
+tomfoolery, but if not, you can install system-wide:
+
+ $ sudo ./setup.py install
diff --git a/TODO b/TODO
index 55b1e5b..6b3d619 100644
--- a/TODO
+++ b/TODO
@@ -54,6 +54,8 @@
# Then
- debian packaging
+ http://pypi.python.org/pypi/stdeb
+ http://stackoverflow.com/questions/909138/how-do-i-add-an-init-d-script-into-a-deb?rq=1
- admin authentication scheme
- only listen on local ethernet interface (enforce with firewall?)
- not-root permissions scheme for: interfaces, tor, wireless, ssh keys
@@ -67,4 +69,4 @@
- OONI
- historical bandwidth etc charts with mrtg
- realtime charts with http://www.flotcharts.org/ or similar
-
+- switch to pylens instead of python-augeas?
diff --git a/helpers/__init__.py b/helpers/__init__.py
deleted file mode 100644
index 8b13789..0000000
--- a/helpers/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/runserver.py b/runserver.py
new file mode 100755
index 0000000..8e55e18
--- /dev/null
+++ b/runserver.py
@@ -0,0 +1,7 @@
+#!/usr/bin/env python
+
+from torouterui.server import main
+
+
+if __name__ == '__main__':
+ main()
diff --git a/setup.py b/setup.py
new file mode 100755
index 0000000..b3373be
--- /dev/null
+++ b/setup.py
@@ -0,0 +1,22 @@
+#!/usr/bin/env python
+
+from setuptools import setup
+
+setup(
+ name='torouterui',
+ version='0.0',
+ long_description=__doc__,
+ packages=['torouterui'],
+ include_package_data=True,
+ zip_safe=False,
+ install_requires=[
+ 'Flask',
+ 'python-augeas',
+ ],
+ dependancy_links=['https://fedorahosted.org/released/python-augeas/'],
+ entry_points = {
+ 'console_scripts': [
+ 'torouterui = torouterui.server:main',
+ ],
+ },
+)
diff --git a/torouterui/__init__.py b/torouterui/__init__.py
new file mode 100644
index 0000000..c6517f5
--- /dev/null
+++ b/torouterui/__init__.py
@@ -0,0 +1,4 @@
+from flask import Flask
+app = Flask(__name__)
+
+import torouterui.views
diff --git a/helpers/netif.py b/torouterui/netif.py
index d8347a0..d8347a0 100644
--- a/helpers/netif.py
+++ b/torouterui/netif.py
diff --git a/torouterui/server.py b/torouterui/server.py
new file mode 100644
index 0000000..17cd5ca
--- /dev/null
+++ b/torouterui/server.py
@@ -0,0 +1,13 @@
+
+from torouterui import app
+import argparse
+
+
+def main():
+ """Primary entry-point for torouterui.
+ """
+ parser = argparse.ArgumentParser()
+ parser.add_argument('--debug', action='store_true',
+ help="enable debugging interface")
+ args = parser.parse_args()
+ app.run(debug=args.debug)
diff --git a/static/css/bootstrap.min.css b/torouterui/static/css/bootstrap.min.css
index 51c0e59..51c0e59 100644
--- a/static/css/bootstrap.min.css
+++ b/torouterui/static/css/bootstrap.min.css
diff --git a/static/favicon.ico b/torouterui/static/favicon.ico
index e69de29..e69de29 100644
--- a/static/favicon.ico
+++ b/torouterui/static/favicon.ico
diff --git a/static/img/glyphicons-halflings-white.png b/torouterui/static/img/glyphicons-halflings-white.png
index 3bf6484..3bf6484 100644
--- a/static/img/glyphicons-halflings-white.png
+++ b/torouterui/static/img/glyphicons-halflings-white.png
Binary files differ
diff --git a/static/img/glyphicons-halflings.png b/torouterui/static/img/glyphicons-halflings.png
index a996999..a996999 100644
--- a/static/img/glyphicons-halflings.png
+++ b/torouterui/static/img/glyphicons-halflings.png
Binary files differ
diff --git a/static/robots.txt b/torouterui/static/robots.txt
index e69de29..e69de29 100644
--- a/static/robots.txt
+++ b/torouterui/static/robots.txt
diff --git a/helpers/sysstatus.py b/torouterui/sysstatus.py
index 32caa26..32caa26 100644
--- a/helpers/sysstatus.py
+++ b/torouterui/sysstatus.py
diff --git a/templates/base.html b/torouterui/templates/base.html
index 4c15c73..4c15c73 100644
--- a/templates/base.html
+++ b/torouterui/templates/base.html
diff --git a/templates/home.html b/torouterui/templates/home.html
index fa2ed2b..fa2ed2b 100644
--- a/templates/home.html
+++ b/torouterui/templates/home.html
diff --git a/templates/lan.html b/torouterui/templates/lan.html
index 09bcf0a..09bcf0a 100644
--- a/templates/lan.html
+++ b/torouterui/templates/lan.html
diff --git a/templates/lib.html b/torouterui/templates/lib.html
index 6ac5e12..6ac5e12 100644
--- a/templates/lib.html
+++ b/torouterui/templates/lib.html
diff --git a/templates/logs.html b/torouterui/templates/logs.html
index c5ea52a..c5ea52a 100644
--- a/templates/logs.html
+++ b/torouterui/templates/logs.html
diff --git a/templates/processes.html b/torouterui/templates/processes.html
index 2e35162..2e35162 100644
--- a/templates/processes.html
+++ b/torouterui/templates/processes.html
diff --git a/templates/reboot.html b/torouterui/templates/reboot.html
index b9f0c54..b9f0c54 100644
--- a/templates/reboot.html
+++ b/torouterui/templates/reboot.html
diff --git a/templates/tor.html b/torouterui/templates/tor.html
index a1f30dc..a1f30dc 100644
--- a/templates/tor.html
+++ b/torouterui/templates/tor.html
diff --git a/templates/wan.html b/torouterui/templates/wan.html
index 2da2733..2da2733 100644
--- a/templates/wan.html
+++ b/torouterui/templates/wan.html
diff --git a/templates/wifi.html b/torouterui/templates/wifi.html
index 3e41788..3e41788 100644
--- a/templates/wifi.html
+++ b/torouterui/templates/wifi.html
diff --git a/helpers/tor.py b/torouterui/tor.py
index ef585c5..ef585c5 100644
--- a/helpers/tor.py
+++ b/torouterui/tor.py
diff --git a/helpers/util.py b/torouterui/util.py
index dc3b6c0..dc3b6c0 100644
--- a/helpers/util.py
+++ b/torouterui/util.py
diff --git a/torouterui.py b/torouterui/views.py
index fe72475..af17be8 100755..100644
--- a/torouterui.py
+++ b/torouterui/views.py
@@ -1,4 +1,3 @@
-#!/usr/bin/env python
"""
Main Flask web application code for the torouter user interface. See also
README and TODO.
@@ -15,14 +14,12 @@ This code under a BSD license; see LICENSE file included with this code.
"""
from flask import Flask, render_template, send_from_directory, request
-import argparse
import os
-from helpers import sysstatus
-from helpers import netif
-from helpers import tor
-
-app = Flask(__name__)
+from torouterui import app
+import torouterui.sysstatus as sysstatus
+import torouterui.netif as netif
+import torouterui.tor as tor
@app.route('/')
@@ -220,11 +217,3 @@ def robots():
'robots.txt',
mimetype='text/plain')
-##############################################################################
-
-if __name__ == '__main__':
- parser = argparse.ArgumentParser()
- parser.add_argument('--debug', action='store_true',
- help="enable debugging interface")
- args = parser.parse_args()
- app.run(debug=args.debug)