[llvm-commits] [zorg] r125936 - in /zorg/trunk/llvmlab: llvmlab/llvmlabtool/app.wsgi.sample llvmlab/llvmlabtool/main.py setup.py
Daniel Dunbar
daniel at zuster.org
Fri Feb 18 08:44:56 PST 2011
Author: ddunbar
Date: Fri Feb 18 10:44:56 2011
New Revision: 125936
URL: http://llvm.org/viewvc/llvm-project?rev=125936&view=rev
Log:
llvmlab create: Auto generated a .wsgi file suitable for use with Apache.
Added:
zorg/trunk/llvmlab/llvmlab/llvmlabtool/app.wsgi.sample
Modified:
zorg/trunk/llvmlab/llvmlab/llvmlabtool/main.py
zorg/trunk/llvmlab/setup.py
Added: zorg/trunk/llvmlab/llvmlab/llvmlabtool/app.wsgi.sample
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/llvmlab/llvmlab/llvmlabtool/app.wsgi.sample?rev=125936&view=auto
==============================================================================
--- zorg/trunk/llvmlab/llvmlab/llvmlabtool/app.wsgi.sample (added)
+++ zorg/trunk/llvmlab/llvmlab/llvmlabtool/app.wsgi.sample Fri Feb 18 10:44:56 2011
@@ -0,0 +1,10 @@
+#!/usr/bin/env python2.6
+# -*- Python -*-
+%(site_import_string)s
+import llvmlab.ui.app
+application = llvmlab.ui.app.App.create_standalone(
+ config_path = %(lab_config_path)r)
+
+if __name__ == "__main__":
+ import werkzeug
+ werkzeug.run_simple('localhost', 5000, application)
Modified: zorg/trunk/llvmlab/llvmlab/llvmlabtool/main.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/llvmlab/llvmlab/llvmlabtool/main.py?rev=125936&r1=125935&r2=125936&view=diff
==============================================================================
--- zorg/trunk/llvmlab/llvmlab/llvmlabtool/main.py (original)
+++ zorg/trunk/llvmlab/llvmlab/llvmlabtool/main.py Fri Feb 18 10:44:56 2011
@@ -68,6 +68,7 @@
install_path, = args
install_path = os.path.abspath(install_path)
cfg_path = os.path.join(install_path, 'lab.cfg')
+ app_path = os.path.join(install_path, 'app.wsgi')
# Create the install directory.
if os.path.exists(install_path):
@@ -99,6 +100,28 @@
cfg_file.write(cfg_data)
cfg_file.close()
+ # Construct the WSGI app file.
+ app_wsgi_path = os.path.join(os.path.abspath(os.path.dirname(__file__)),
+ "app.wsgi.sample")
+ app_wsgi_file = open(app_wsgi_path, "rb")
+ app_wsgi_data = app_wsgi_file.read()
+ app_wsgi_file.close()
+
+ # Fill in the sample WSGI app.
+ virtual_env = os.environ.get('VIRTUAL_ENV')
+ if virtual_env:
+ site_import_string = """
+import site
+site.addsitedir(%r)\n""" % virtual_env
+ else:
+ site_import_string = ""
+
+ app_data = app_wsgi_data % { 'site_import_string' : site_import_string,
+ 'lab_config_path' : cfg_path }
+ app_file = open(app_path, 'w')
+ app_file.write(app_data)
+ app_file.close()
+
# Construct the initial database and status files.
data = llvmlab.data.Data(users = [], machines = [])
status = llvmlab.ci.status.Status(opts.master_url, {})
Modified: zorg/trunk/llvmlab/setup.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/llvmlab/setup.py?rev=125936&r1=125935&r2=125936&view=diff
==============================================================================
--- zorg/trunk/llvmlab/setup.py (original)
+++ zorg/trunk/llvmlab/setup.py Fri Feb 18 10:44:56 2011
@@ -35,7 +35,7 @@
],
# Additional resource extensions we use.
- package_data = { 'llvmlab.llvmlabtool' : ['lab.cfg.sample'],
+ package_data = { 'llvmlab.llvmlabtool' : ['*.sample'],
'llvmlab.ui' : ['static/*.ico',
'static/*.css',
'static/*.js',
More information about the llvm-commits
mailing list