paulb@362 | 1 | #!/usr/bin/env python |
paulb@362 | 2 | |
paulb@362 | 3 | "Start the demonstration program." |
paulb@362 | 4 | |
paulb@362 | 5 | import os, sys |
paulb@362 | 6 | |
paulb@362 | 7 | # Find out where WebStack's distribution directory is. |
paulb@362 | 8 | |
paulb@362 | 9 | cwd = os.getcwd() |
paulb@362 | 10 | parts = os.path.split(cwd) |
paulb@362 | 11 | if parts[-1] == "tools": |
paulb@362 | 12 | parts = parts[:-1] |
paulb@362 | 13 | base = os.path.join(*parts) |
paulb@362 | 14 | |
paulb@369 | 15 | # Set up a sessions directory if necessary. |
paulb@369 | 16 | |
paulb@369 | 17 | sessions = os.path.join(base, "WebStack-sessions") |
paulb@369 | 18 | if not os.path.exists(sessions): |
paulb@369 | 19 | os.mkdir(sessions) |
paulb@369 | 20 | |
paulb@362 | 21 | # Set up the environment and run the demo program. |
paulb@362 | 22 | |
paulb@404 | 23 | pythonpath = os.environ.get("PYTHONPATH") |
paulb@401 | 24 | if pythonpath: |
paulb@401 | 25 | pythonpath = pythonpath + os.pathsep |
paulb@401 | 26 | |
paulb@401 | 27 | os.environ["PYTHONPATH"] = "%s%s%s%s" % (pythonpath, base, os.pathsep, os.path.join(base, "examples", "Common")) |
paulb@362 | 28 | os.system("%s %s" % (sys.executable, os.path.join(base, "examples", "BaseHTTPRequestHandler", "DemoApp.py"))) |
paulb@362 | 29 | |
paulb@362 | 30 | # vim: tabstop=4 expandtab shiftwidth=4 |