1 | #!/usr/bin/env python |
---|
2 | # encoding: utf-8 |
---|
3 | """ |
---|
4 | update-tmdmcreator.py |
---|
5 | |
---|
6 | Created by Lucien Schreiber on 2013-02-15. |
---|
7 | Copyright (c) 2013 . All rights reserved. |
---|
8 | """ |
---|
9 | |
---|
10 | import sys |
---|
11 | import os |
---|
12 | from subprocess import * |
---|
13 | |
---|
14 | #Â compatibililty Python 2.7 and 3.0 |
---|
15 | try: |
---|
16 | from Tkinter import * |
---|
17 | except: |
---|
18 | from tkinter import * |
---|
19 | |
---|
20 | def GetCmakeDirName(): |
---|
21 | pathname = os.path.dirname(sys.argv[0]) |
---|
22 | return os.path.abspath(pathname) |
---|
23 | |
---|
24 | |
---|
25 | def updateSVN(): |
---|
26 | myPath = os.path.normpath(os.path.join(GetCmakeDirName(), "..")) |
---|
27 | print ("Updating subversion in: {}".format(myPath)) |
---|
28 | try: |
---|
29 | p = Popen("svn update", shell=True, cwd = myPath) |
---|
30 | p.wait() |
---|
31 | except: |
---|
32 | print ("Error updating subversion in: {}".format(myPath)) |
---|
33 | |
---|
34 | # print version number |
---|
35 | try: |
---|
36 | p = Popen("svnversion", shell=True, cwd=myPath, stdout=PIPE, stderr=PIPE) |
---|
37 | information = p.communicate() |
---|
38 | myVersion = str(information[0]) |
---|
39 | myVersionAlone = myVersion[myVersion.find("'")+1:-3] |
---|
40 | print ("Updated version is: {}".format(myVersionAlone)) |
---|
41 | except: |
---|
42 | print("Error getting version for {}".format(GetCmakeDirName())) |
---|
43 | |
---|
44 | |
---|
45 | def buildMacBook(): |
---|
46 | builddir = "/Users/lucien/DATA/PRJ/DATAMODEL/bin" |
---|
47 | try: |
---|
48 | p = Popen("cmake -GXcode " + GetCmakeDirName() + " -DCMAKE_OSX_ARCHITECTURES:TEXT=x86_64 -DCMAKE_OSX_DEPLOYMENT_TARGET:TEXT=10.6 -DCMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE:FILE=/Users/lucien/DATA/PROGRAMATION/_LIB/64/_LIBWXSVN/bin/wx-config", shell=True, cwd=builddir) |
---|
49 | p.wait() |
---|
50 | except: |
---|
51 | print("Error creating makefile") |
---|
52 | |
---|
53 | |
---|
54 | def buildWindow7(): |
---|
55 | builddir = "D:\\PRJ\\DATAMODEL\\bin" |
---|
56 | try: |
---|
57 | p = Popen("cmake -G\"Visual Studio 10\" " + GetCmakeDirName() + " -DUSE_MT_LIBRARY:BOOL=1", shell=True, cwd=builddir) |
---|
58 | p.wait() |
---|
59 | except: |
---|
60 | print("Error creating makefile") |
---|
61 | |
---|
62 | if __name__ == '__main__': |
---|
63 | root = Tk() |
---|
64 | myContainer1 = Frame(root) |
---|
65 | myContainer1.pack() |
---|
66 | |
---|
67 | label = Label(myContainer1, text="TmDmCreator") |
---|
68 | label.pack() |
---|
69 | |
---|
70 | button3 = Button(myContainer1, text=("Update subversion"), command=updateSVN) |
---|
71 | button3.pack() |
---|
72 | |
---|
73 | button2 = Button(myContainer1, text="Configure MacBook", command=buildMacBook) |
---|
74 | button2.pack() |
---|
75 | |
---|
76 | button4 = Button(myContainer1, text="Configure Window 7", command=buildWindow7) |
---|
77 | button4.pack() |
---|
78 | |
---|
79 | root.mainloop() |
---|