Changeset 2484 for 2011


Ignore:
Timestamp:
2011-08-02 10:47:20 (8 years ago)
Author:
tekrjant
Message:

The time of last commit is written to the report instead of the time of last build.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 2011/31/build_games.py

    r2458 r2484  
    88from subprocess import * 
    99from datetime import * 
     10import re 
    1011 
    1112 
     
    4243 
    4344 
     45def parse_last_changed_date(svn_info_output): 
     46    match = re.search("Last Changed Date: (\\d\\d\\d\\d)-(\\d\\d)-(\\d\\d) (\\d\\d):(\\d\\d)", svn_info_output) 
     47    if not match: 
     48        raise Exception("Last Changed Date not found from svn info output!") 
     49    year = int(match.group(1)) 
     50    month = int(match.group(2)) 
     51    day = int(match.group(3)) 
     52    hour = int(match.group(4)) 
     53    minute = int(match.group(5)) 
     54    return datetime(year=year, month=month, day=day, hour=hour, minute=minute) 
     55 
     56 
    4457def build_games(): 
    4558        for d in personal_dirs: 
    4659                path = abspath(d) 
    47                 time_of_update = datetime.now() 
    4860                if exists(join(path, ".svn")): 
    4961                        call("svn update " + path, shell=True) 
    50                 build_games_in_personal_dir(path, time_of_update) 
     62                        outputs = Popen('svn info', stdout=PIPE).communicate() 
     63                        time = parse_last_changed_date(outputs[0]) 
     64                build_games_in_personal_dir(path, time) 
    5165 
    5266 
     
    5468 
    5569 
    56 def write_result(author, name, success, time_of_update): 
     70def write_result(author, name, success, last_changed_date): 
    5771        global counter 
    5872        with open(join(build_result_dir, str(counter)+".txt"), "w") as f: 
     
    6377                        result = "fail" 
    6478                f.write(result+"\n") 
    65                 formatted_time = time_of_update.strftime("%H:%M") 
     79                formatted_time = last_changed_date.strftime("%H:%M") 
    6680                f.write(formatted_time+"\n") 
    6781        counter += 1 
    6882 
    6983 
    70 def build_games_in_personal_dir(personal_dir, time_of_update): 
     84def build_games_in_personal_dir(personal_dir, last_changed_date): 
    7185        for root, dirs, files in os.walk(personal_dir): 
    7286                if '.svn' in dirs: 
     
    8195 
    8296                        success = build(projects[0]) 
    83                         write_result(author, project_name, success, time_of_update) 
     97                        write_result(author, project_name, success, last_changed_date) 
    8498 
    8599                        if success: 
Note: See TracChangeset for help on using the changeset viewer.