Commit a0baff24 authored by Michael Murtaugh's avatar Michael Murtaugh
Browse files

linted css is nice

parent a90753e3
......@@ -76,7 +76,7 @@ body {
right: 0;
top: 0;
bottom: 0;
background: #f008;
background: #f000;
display: none;
}
......
......@@ -20,7 +20,7 @@ MAKE = {
MAKE_BY_CODE = {code: value for value, code in MAKE.items()}
async def is_makeable (path, cwd=".", makefile="makefile", make="make"):
async def is_makeable (path, cwd=".", makefile="makefile", make="make", verbose=False):
"""
returns:
0=file is up to date,
......@@ -31,11 +31,12 @@ async def is_makeable (path, cwd=".", makefile="makefile", make="make"):
p = await create_subprocess_exec(make, "--question", "-f", makefile, rpath, cwd = cwd, stdout=DEVNULL, stderr=DEVNULL)
# retcode 0=file is up to date, 1=file needs remaking, 2=file is not makeable
ret = await p.wait()
print (f"{make} --question -f {makefile} {path} returned: {MAKE_BY_CODE[ret]}", file=sys.stderr)
if verbose:
print (f"{make} --question -f {makefile} {path} returned: {MAKE_BY_CODE[ret]}", file=sys.stderr)
await log(f"is_makeable {0}: {MAKE_BY_CODE[ret]}".format(path, ret))
return ret
async def make (path, cwd=".", makefile="makefile", make="make", force=False):
async def make (path, cwd=".", makefile="makefile", make="make", force=False, verbose=False):
rpath = os.path.relpath(path, cwd)
makeargs = [make, "-f", makefile, rpath]
if force:
......@@ -50,7 +51,8 @@ async def make (path, cwd=".", makefile="makefile", make="make", force=False):
# log(line)
# print (line)
ret = await p.wait() == 0
print ("make {0}: {1}".format(path, ret), file=sys.stderr)
if verbose:
print ("make {0}: {1}".format(path, ret), file=sys.stderr)
await log("make {0}: {1}".format(path, ret))
return (ret, resp)
......@@ -176,7 +178,7 @@ async def route_get (request):
# return FileResponse(filepath, chunk_size=self._chunk_size)
# print ("rOUTE_get", request.rel_url, request.rel_url.query)
path = urlunquote(urlparse(request.rel_url.raw_path.lstrip("/")).path)
print ("GET", path, file=sys.stderr)
# print ("GET", path, file=sys.stderr)
if path == '':
path = '.'
makefile = request.app['makefile']
......@@ -209,10 +211,11 @@ async def route_get (request):
raise web.HTTPNotFound()
# return web.Response(text="404 on path {0}".format(path))
async def route_post (request):
async def route_post (request, verbose=False):
""" write posted text value to file """
path = urlunquote(urlparse(request.rel_url.raw_path.lstrip("/")).path)
print ("POST", path, file=sys.stderr)
if verbose:
print ("POST", path, file=sys.stderr)
# if os.path.exists(path) and os.path.isfile(path):
# POST CAN CLOBBER ANY FILES THAT ARE WRITABLE BY THE USER !
# this is maybe a way too dangerous default ...
......@@ -257,16 +260,16 @@ async def log (msg):
async def websocket_handler(request):
print('Websocket connection starting')
# print('Websocket connection starting')
ws = web.WebSocketResponse()
await ws.prepare(request)
print('Websocket connection ready')
# print('Websocket connection ready')
active_sockets.append(ws)
async for msg in ws:
print(msg)
# print(msg)
if msg.type == aiohttp.WSMsgType.TEXT:
print(msg.data)
# print(msg.data)
if msg.data == 'close':
await ws.close()
else:
......@@ -274,7 +277,7 @@ async def websocket_handler(request):
active_sockets.remove(ws)
print('Websocket connection closed')
# print('Websocket connection closed')
return ws
......
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