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/TOOLMAP2/bin_apps/shpimporter" |
---|
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 | |
---|
55 | if __name__ == '__main__': |
---|
56 | root = Tk() |
---|
57 | myContainer1 = Frame(root) |
---|
58 | myContainer1.pack() |
---|
59 | |
---|
60 | label = Label(myContainer1, text="TmDmCreator") |
---|
61 | label.pack() |
---|
62 | |
---|
63 | button3 = Button(myContainer1, text=("Update subversion"), command=updateSVN) |
---|
64 | button3.pack() |
---|
65 | |
---|
66 | button2 = Button(myContainer1, text="Configure MacBook", command=buildMacBook) |
---|
67 | button2.pack() |
---|
68 | |
---|
69 | root.mainloop() |
---|