- Timestamp:
- 2011-06-28 15:55:35 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
2011/24/build_games.py
r2140 r2248 6 6 from glob import * 7 7 from subprocess import * 8 from xml.dom.minidom import Document 9 8 10 9 11 output_dir = abspath("pelit") … … 11 13 personal_dirs = [d for d in os.listdir(".") if isdir(d) and d not in ("lib", basename(output_dir), ".svn")] 12 14 projects_that_did_not_build = [] 15 report = Document() 16 document_root = "" 13 17 14 18 def check_requirements(): … … 29 33 30 34 35 def addElement(parent, name, value): 36 node = report.createElement(name) 37 parent.appendChild(node) 38 node.appendChild(report.createTextNode(str(value))) 39 40 41 def add_to_report(author, name, success): 42 e = report.createElement("game") 43 document_root.appendChild(e) 44 45 addElement(e, "author", author) 46 addElement(e, "name", name) 47 addElement(e, "success", success) 48 49 31 50 def build_games_in_personal_dir(personal_dir): 32 51 for root, dirs, files in os.walk(personal_dir): … … 37 56 if len(projects) > 1: 38 57 print "NOTE: There is more than one project file in", root 39 if build(projects[0]): 40 project_name = splitext(basename(projects[0]))[0] 41 dst_dir = join(output_dir, basename(personal_dir)) 58 59 project_name = splitext(basename(projects[0]))[0] 60 author = basename(personal_dir) 61 62 success = build(projects[0]) 63 add_to_report(author, project_name, success) 64 65 if success: 66 dst_dir = join(output_dir, author) 42 67 copy_game(project_name, root, dst_dir) 43 print basename(personal_dir)+ ": " + project_name68 print author + ": " + project_name 44 69 else: 45 70 projects_that_did_not_build.append(projects[0]) … … 61 86 62 87 88 def initialize_report(): 89 global document_root 90 document_root = report.createElement("games") 91 report.appendChild(document_root) 92 93 94 def write_report(): 95 with open("build_report.xml", "w") as f: 96 f.write(report.toprettyxml()) 97 98 63 99 def main(): 64 100 try: 101 initialize_report() 65 102 check_requirements() 66 103 create_output_directory() 67 104 build_games() 105 write_report() 68 106 except KeyboardInterrupt: 69 107 print "BUILD CANCELLED"
Note: See TracChangeset
for help on using the changeset viewer.