def compile_mingw():
    build_dir=EnigmaSettings.getEnigmaDir()
    cwd = os.getcwd() # get current directory
    try:
       os.chdir(build_dir)
       return ConvertingEnigma.run_command("make Game GMODE=Run GRAPHICS=OpenGL AUDIO=None COLLISION=BBox WIDGETS=None PLATFORM=Win32 CXX=\"/usr/local/i386-mingw32-4.3.0/bin/i386-mingw32-g++ -Wfatal-errors -w -I./Platforms/Win32/ffi -I./../additional/zlib -L./Platforms/Win32/ffi -L./../additional/zlib\" CC=\"/usr/local/i386-mingw32-4.3.0/bin/i386-mingw32-gcc -Wfatal-errors -w\" COMPILEPATH=MacOSX/Windows EXTENSIONS=\"Universal_System/Extensions/Alarms Universal_System/Extensions/Timelines Universal_System/Extensions/Paths Universal_System/Extensions/MotionPlanning Universal_System/Extensions/Unimplemented Universal_System/Extensions/DateTime Universal_System/Extensions/DataStructures\" OUTPUTNAME=\"/Users/alasdairmorrison/Enigma/Enigma_clean_April_2012/EnigmaXcode.exe\"")
    finally:
      os.chdir(cwd)
def compile_mingw():
    build_dir=EnigmaSettings.getEnigmaDir()
    cwd = os.getcwd() # get current directory
    try:
       os.chdir(build_dir)
       return ConvertingEnigma.run_command("make Game GMODE=Run GRAPHICS=OpenGL AUDIO=None COLLISION=BBox WIDGETS=None PLATFORM=Win32 CXX=\"/usr/local/i386-mingw32-4.3.0/bin/i386-mingw32-g++ -Wfatal-errors -w -I./Platforms/Win32/ffi -I./../additional/zlib -L./Platforms/Win32/ffi -L./../additional/zlib\" CC=\"/usr/local/i386-mingw32-4.3.0/bin/i386-mingw32-gcc -Wfatal-errors -w\" COMPILEPATH=MacOSX/Windows EXTENSIONS=\"Universal_System/Extensions/Alarms Universal_System/Extensions/Timelines Universal_System/Extensions/Paths Universal_System/Extensions/MotionPlanning Universal_System/Extensions/Unimplemented Universal_System/Extensions/DateTime Universal_System/Extensions/DataStructures\" OUTPUTNAME=\"/Users/alasdairmorrison/Enigma/Enigma_clean_April_2012/EnigmaXcode.exe\"")
    finally:
      os.chdir(cwd)
    

now = datetime.datetime.now()
g_platform=sys.platform
#create the table for this revision if not already created
table_date=calendar.month_abbr[now.month]+"_"+str(now.day)+"_"+str(now.year)
db_table="64D_"+g_platform+"__"+table_date
ConvertingEnigma.createTable(c,db_table)
if g_compileForWindows==True: g_windowsTable="64D_win32__"+table_date; ConvertingEnigma.createTable(c,g_windowsTable)

#start
startingDir = os.getcwd()
get_games_query="""SELECT ID, Name, SiteLink, DownloadLink FROM GameDetails WHERE ID>"""+str(minimum_example)+""" ORDER BY ID LIMIT """+str(maximum_number)

if (g_only_failed_compiles):
    get_games_query="""SELECT a.ID, a.Name, a.SiteLink, a.DownloadLink, b.Compile_Succesful
FROM GameDetails AS a LEFT JOIN """+db_table+""" AS b ON a.ID = b.example WHERE a.ID>"""+str(minimum_example)+""" AND b.Compile_Succesful=0 ORDER BY a.ID"""
    
db.query(get_games_query) #ORDER BY ID DESC

r=db.store_result()
for download_rows in range(0,maximum_number):
    game_start_time = time.time()