blob: c53057a44a9456042bd1b57eccb634123c83aa1b [file] [log] [blame]
rtc@google.comded22402009-10-26 22:36:21 +00001# Copyright (c) 2009 The Chromium OS Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5import autoupdate
6import buildutil
7import os
8import web
9
10app_id = "87efface-864d-49a5-9bb3-4b050a7c227a"
11root_dir = "/usr/local/google/home/rtc/chromeos/trunk/src"
12scripts_dir = "%s/scripts" % root_dir
13app_dir = os.popen("pwd").read().strip()
14static_dir = "%s/static" % app_dir
15web.debug("Serving images from %s/static" % app_dir)
16
17urls = ('/', 'index',
18 '/update', 'update')
19
20app = web.application(urls, globals())
21render = web.template.render('templates/')
22
23
24class index:
25 def GET(self):
26 pkgs = buildutil.GetPackages()
27 return render.index(pkgs)
28
29class update:
30 """
31 Processes updates from the client machine. If an update is found, the url
32 references a static link that can be served automagically from web.py.
33 """
34 def POST(self):
35 return autoupdate.HandleUpdatePing(web.data())
36
37if __name__ == "__main__":
38 web.debug("Setting up the static repo")
39 os.system("mkdir -p %s" % static_dir)
40 app.run()
41