# Path: common/httpd.py
# class ThreadedHTTPServer(SocketServer.ThreadingMixIn,
#                          BaseHTTPServer.HTTPServer):
# class BaseRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
#   def url_to_fs_path(self, url):
#   def send_head(self):
# 
# Path: common/util.py
# ANSI_BLUE = '\033[36m'
# ANSI_GREEN = '\033[32m'
# ANSI_RESET = '\033[0;0m'
# class Logger(object):
#   def __init__(self, color):
#   def __call__(self, msg, *args):
# def GetPackageDir():
# def GetUserDir():
# 
# Path: common/spy.py
# class Error(Exception):
# class UsageReporter(object):
# class NullUsageReporter(object):
#   def __init__(self, host_port):
#   def Send(self, msg):
#   def SendDict(self, d):
#   def SendRecord(self, event, d):
#   def Send(self, msg):
#   def SendDict(self, d):
#   def SendRecord(self, event, d):
# def _GetUsageConfig():
# def _ReadAddressFile(address_file=None):
# def GetClientFromConfig(address_file=None):


import datetime
import errno
import getpass
import json
import optparse
import os
import Queue
import threading
import string  # for lower case letters
import sys
import handlers
import tnet
from common import httpd
from common import util
from common import spy
    # Write index.html in the session dir.
    package_dir = util.GetPackageDir()
    path = os.path.join(package_dir, 'webpipe/index.html')
    with open(path) as f:
      index_html = f.read()

    out_path = os.path.join(scroll_path, 'index.html')
    with open(out_path, 'w') as f:
      f.write(index_html)

    waiter = handlers.SequenceWaiter()
    try:
      Serve(opts, scroll_path, waiter, package_dir)
    except KeyboardInterrupt:
      log('Stopped')
      return waiter.Length()

  elif action == 'noop':
    # For testing latency
    log('noop')

  else:
    raise Error('Invalid action %r' % action)


def main(argv):
  """Returns an exit code."""

  # In this process we send start and end records.  In the xrender process, we
  # send latency for each rendering.

# Path: common/httpd.py
# class ThreadedHTTPServer(SocketServer.ThreadingMixIn,
#                          BaseHTTPServer.HTTPServer):
# class BaseRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
#   def url_to_fs_path(self, url):
#   def send_head(self):
# 
# Path: common/util.py
# ANSI_BLUE = '\033[36m'
# ANSI_GREEN = '\033[32m'
# ANSI_RESET = '\033[0;0m'
# class Logger(object):
#   def __init__(self, color):
#   def __call__(self, msg, *args):
# def GetPackageDir():
# def GetUserDir():
# 
# Path: common/spy.py
# class Error(Exception):
# class UsageReporter(object):
# class NullUsageReporter(object):
#   def __init__(self, host_port):
#   def Send(self, msg):
#   def SendDict(self, d):
#   def SendRecord(self, event, d):
#   def Send(self, msg):
#   def SendDict(self, d):
#   def SendRecord(self, event, d):
# def _GetUsageConfig():
# def _ReadAddressFile(address_file=None):
# def GetClientFromConfig(address_file=None):


# Path: webpipe/serve.py
import datetime
import errno
import getpass
import json
import optparse
import os
import Queue
import threading
import string  # for lower case letters
import sys
import handlers
import tnet
from common import httpd
from common import util
from common import spy

    # Write index.html in the session dir.
    package_dir = util.GetPackageDir()
    path = os.path.join(package_dir, 'webpipe/index.html')
    with open(path) as f:
      index_html = f.read()

    out_path = os.path.join(scroll_path, 'index.html')
    with open(out_path, 'w') as f:
      f.write(index_html)

    waiter = handlers.SequenceWaiter()
    try:
      Serve(opts, scroll_path, waiter, package_dir)
    except KeyboardInterrupt:
      log('Stopped')
      return waiter.Length()

  elif action == 'noop':
    # For testing latency
    log('noop')

  else:
    raise Error('Invalid action %r' % action)


def main(argv):
  """Returns an exit code."""

  # In this process we send start and end records.  In the xrender process, we
  # send latency for each rendering.

  spy_client = spy.GetClientFromConfig()