Browse Source

Trying to get `abserver` to install automatically

master
Pete Shadbolt 7 years ago
parent
commit
6763052d4f
2 changed files with 13 additions and 1 deletions
  1. +4
    -1
      bin/abpserver
  2. +9
    -0
      setup.py

abp/server.py → bin/abpserver View File

@@ -1,3 +1,4 @@
#!/usr/bin/python
from websocket_server import WebsocketServer from websocket_server import WebsocketServer
from SimpleHTTPServer import SimpleHTTPRequestHandler from SimpleHTTPServer import SimpleHTTPRequestHandler
from BaseHTTPServer import HTTPServer from BaseHTTPServer import HTTPServer
@@ -5,9 +6,11 @@ from SocketServer import ThreadingMixIn
import os, sys, threading import os, sys, threading
import webbrowser import webbrowser
import argparse import argparse
import abp


clients = [] clients = []



def new_message(client, server, message): def new_message(client, server, message):
print "Received update from client {}.".format(client["id"]) print "Received update from client {}.".format(client["id"])
server.send_message_to_all(message) server.send_message_to_all(message)
@@ -29,7 +32,7 @@ if __name__ == '__main__':
args = parser.parse_args() args = parser.parse_args()


# Change to the right working dir # Change to the right working dir
where = os.path.join(sys.path[0], "../static")
where = os.path.join(os.path.dirname(abp.__path__[0]), "static")
os.chdir(where) os.chdir(where)


# Start the HTTP server # Start the HTTP server

+ 9
- 0
setup.py View File

@@ -1,4 +1,11 @@
from setuptools import setup, find_packages from setuptools import setup, find_packages
from glob import glob
from os import path

APPNAME = "abp"
STATIC = glob("static/*.*")+glob("static/img/*.*")+glob("static/scripts/*.*")
appdata = path.expanduser(path.join("~", "." + APPNAME))
print appdata


setup( setup(
name = "abp", name = "abp",
@@ -9,5 +16,7 @@ setup(
description = "Port of C++ due to Simon Anders and Hans J Briegel", description = "Port of C++ due to Simon Anders and Hans J Briegel",
keywords = "quantum", keywords = "quantum",
setup_requires = ["numpy"], setup_requires = ["numpy"],
scripts = ["bin/abpserver"],
install_requires = ["numpy", "networkx", "tqdm", "websocket-client", "websocket-server"], install_requires = ["numpy", "networkx", "tqdm", "websocket-client", "websocket-server"],
data_files = [("static", STATIC)]
) )

Loading…
Cancel
Save