Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

[r7423]: build / buildmaster / build_qs_projects.py Maximize Restore History

Download this file

build_qs_projects.py    67 lines (54 with data), 1.8 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
"""A script which calls tg-admin with every possible combination of Identity enabled/disabled, SQLObject/SQLAlchemy/Elixir and Kid/Genshi."""
__program__ = "build_qs_projects.py"
__author__ = "Steven Mohr"
__version__ = "0.1"
__revision__ = "$Rev:$"
__date__ = "$Date:$"
__copyright__ = "MIT license"
import os
import sys
from subprocess import call, Popen, PIPE, STDOUT
# tg-admin quickstart options
identity = dict(
no_identity = '',
identity = '-i',
)
sql = dict(
elixir = '-e',
sqlobject = '-o',
sqlalchemy = '-s',
)
template = dict(
kid = '',
genshi = '--template=tggenshi',
)
def run_quickstart(cmdline):
"""Run 'tg-admin quickstart' with given command line."""
cmdline = ["tg-admin", "quickstart"] + cmdline
# for debugging
print " ".join(cmdline)
if "-i" not in cmdline:
p = Popen(cmdline, shell=False, env=os.environ,
stdin=PIPE, stderr=STDOUT, stdout=PIPE, close_fds=True)
print p.communicate("n\n")[0]
return p.wait()
else:
return call(cmdline, shell=False, close_fds=True, env=os.environ,)
def main(args):
for idtype, idval in identity.items():
for ormtype, ormval in sql.items():
for tmpltype, tmplval in template.items():
project_name = "qs_%s_%s_%s" % (idtype, ormtype, tmpltype)
pkg_name = "qstest"
cmdline = [ormval, "--package=%s" % pkg_name, project_name]
if idval:
cmdline.insert(0, idval)
if tmplval:
cmdline.insert(0, tmplval)
# XXX do something with retcode
retcode = run_quickstart(cmdline)
return 0
if __name__ == '__main__':
sys.exit(main(sys.argv[1:]))