~ubuntu-branches/ubuntu/vivid/mygui/vivid

« back to all changes in this revision

Viewing changes to Scripts/prepareRelease.py

  • Committer: Package Import Robot
  • Author(s): Scott Howard, Bret Curtis, Scott Howard
  • Date: 2014-09-18 17:57:48 UTC
  • mfrom: (1.1.1)
  • Revision ID: package-import@ubuntu.com-20140918175748-dd8va78mvpw1jbes
Tags: 3.2.1-1
[ Bret Curtis ]
* Updated license for majority of files from LGPL to Expat (MIT)

[ Scott Howard ]
* New upstream release
* Updated patch to add build option for system GLEW libraries
* All patches accepted upstream except shared_libraries.patch
* Bumped SONAME due to dropped symbols, updated *.symbols and package
  names
* Updated license of debian/* to Expat with permission of all authors
* Don't install Doxygen autogenerated md5 and map files (thanks
  lintian)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/env python
2
 
# python 2.6 required (for os.path.relpath)
3
 
 
4
 
# Replace absolute paths with relative
5
 
# goes through recursively from ../release directory
6
 
 
7
 
import os, filecmp
8
 
 
9
 
directories_release = ['..\solution_directx', '..\solution_ogre', '..\solution_opengl']
10
 
dir_sources = '..'
11
 
 
12
 
alllines = []
13
 
currentFolder = ""
14
 
 
15
 
def findChar(line, character, frompos):
16
 
        pos = line.find(character, frompos)
17
 
        if pos == -1:
18
 
                return 999999
19
 
        else:
20
 
                return pos
21
 
def replaceAbsolutePaths(fileName):
22
 
 
23
 
        print "Converting " + fileName
24
 
        file = open(fileName,"r")
25
 
 
26
 
        relpath = os.path.relpath(dir_sources, currentFolder)
27
 
        relpath = relpath.replace('\\','/')
28
 
        #print "Current folder: " + currentFolder
29
 
        #print "Relative path: " + relpath
30
 
        #print "dir_sources: " + dir_sources
31
 
        #print os.path.join(currentFolder, relpath)
32
 
        
33
 
        # trackPrint used for debug only
34
 
        trackPrint = False
35
 
        if (trackPrint):
36
 
                trackPrint = True
37
 
                trackFile = open("trackedLine.txt","w")
38
 
                trackFile.write("original :" + line)
39
 
 
40
 
        line = file.readline()
41
 
        while (line) != "":
42
 
                backSlash = False
43
 
                
44
 
                if (line.find(dir_sources.replace('/','\\')) != -1):
45
 
                        backSlash = True
46
 
                        line = line.replace('\\','/')
47
 
                        if trackPrint:
48
 
                                trackFile.write("replace \\:" + line)
49
 
                pos = line.find(dir_sources)
50
 
                while (pos != -1):
51
 
                        #print "Line changed: " + line.lstrip()
52
 
                        rpos1 = findChar(line,"\"", pos)
53
 
                        rpos2 = findChar(line,"<", pos)
54
 
                        rpos3 = findChar(line,";", pos)
55
 
                        rpos = min(rpos1, min(rpos2, rpos3))
56
 
                        path = line[pos : rpos] #.replace('\\','/')
57
 
                        relpath = os.path.relpath(path, currentFolder).replace('\\','/')
58
 
                        #print path + " | " + relpath
59
 
                        
60
 
                        if trackPrint:
61
 
                                trackFile.write("relpath  :" + relpath + "\n")
62
 
                        
63
 
                        if (backSlash):
64
 
                                relpath = relpath.replace('/','\\')
65
 
                        line = line.replace(path, relpath, 1)
66
 
                        
67
 
                        if trackPrint:
68
 
                                trackFile.write("relpath \\:" + relpath + "\n")
69
 
                                trackFile.write("line unrel" + line)
70
 
                        
71
 
                        #print "to next line: " + line.lstrip()
72
 
                        
73
 
                        pos = line.find(dir_sources)
74
 
                
75
 
                line = line.replace("C:/MYGUIHACK ", "$(")
76
 
                line = line.replace("C:\\MYGUIHACK ", "$(")
77
 
                line = line.replace(" MYGUIBRACKETHACK", ")")
78
 
                
79
 
                if (line.find("cmake.exe") != -1 and line.find("CommandLine") != -1):
80
 
                        lpos = line.find("\"", 0)
81
 
                        rpos = line.find("\"", lpos + 1)
82
 
                        if (trackPrint):
83
 
                                trackFile.write("Remove cmake.exe: " + line)
84
 
                                trackFile.write("           lines: " + str(lpos) + " " + str(rpos) + "\n")
85
 
                                trackFile.write("        replaced: " + line.replace(line[lpos + 1 : rpos], ""))
86
 
                        line = line.replace(line[lpos + 1 : rpos], "")
87
 
                        stopParse = True
88
 
                
89
 
                alllines.append( line )
90
 
                line = file.readline()
91
 
 
92
 
        if trackPrint:
93
 
                trackFile.close()
94
 
 
95
 
        file = open(fileName,"w")
96
 
        #file = open(fileName + ".txt","w")
97
 
        file.writelines(alllines)
98
 
        file.close()
99
 
 
100
 
        del alllines[:]
101
 
 
102
 
def isIgnoredProject(name):
103
 
        #ignores = ["api-docs", "INSTALL", "ALL_BUILD", "ZERO_CHECK", "PACKAGE"]
104
 
        ignores = []
105
 
        for ignore in ignores:
106
 
                if name.startswith(ignore):
107
 
                        return True
108
 
        if name.endswith(".cmake") or name.endswith("tmp"):
109
 
                return True
110
 
        return False
111
 
 
112
 
# ----------
113
 
 
114
 
dir_sources = os.path.realpath(dir_sources)
115
 
dir_sources = dir_sources.replace('\\','/')
116
 
 
117
 
index = 0
118
 
for dir_release in directories_release:
119
 
        index = index+1
120
 
        os.system("mkdir " + dir_release)
121
 
        os.chdir(dir_release)
122
 
        os.system("cmake ../ -DMYGUI_RENDERSYSTEM=" + str(index) + " -DMYGUI_BUILD_UNITTESTS=True -DMYGUI_BUILD_WRAPPER=True -DMYGUI_STANDALONE_BUILD=True -DMYGUI_BUILD_DOCS=True")
123
 
        os.chdir("../Scripts")
124
 
        for root, dirs, files in os.walk(dir_release):
125
 
                for name in files:
126
 
                        if not isIgnoredProject(name):
127
 
                                
128
 
                                f_src = os.path.join(root, name)
129
 
                                f_src = f_src.replace('\\','/')
130
 
                                currentFolder = os.path.realpath(f_src)
131
 
                                currentFolder = currentFolder.replace(name, "")
132
 
                                currentFolder = currentFolder.replace('\\','/')
133
 
                                replaceAbsolutePaths(f_src)
134
 
 
 
1
#!/usr/bin/env python
 
2
# python 2.6 required (for os.path.relpath)
 
3
 
 
4
# Replace absolute paths with relative
 
5
# goes through recursively from ../release directory
 
6
 
 
7
import os, filecmp
 
8
 
 
9
directories_release = ['..\solution_directx', '..\solution_ogre', '..\solution_opengl']
 
10
dir_sources = '..'
 
11
 
 
12
alllines = []
 
13
currentFolder = ""
 
14
 
 
15
def findChar(line, character, frompos):
 
16
        pos = line.find(character, frompos)
 
17
        if pos == -1:
 
18
                return 999999
 
19
        else:
 
20
                return pos
 
21
def replaceAbsolutePaths(fileName):
 
22
 
 
23
        print "Converting " + fileName
 
24
        file = open(fileName,"r")
 
25
 
 
26
        relpath = os.path.relpath(dir_sources, currentFolder)
 
27
        relpath = relpath.replace('\\','/')
 
28
        #print "Current folder: " + currentFolder
 
29
        #print "Relative path: " + relpath
 
30
        #print "dir_sources: " + dir_sources
 
31
        #print os.path.join(currentFolder, relpath)
 
32
        
 
33
        # trackPrint used for debug only
 
34
        trackPrint = False
 
35
        if (trackPrint):
 
36
                trackPrint = True
 
37
                trackFile = open("trackedLine.txt","w")
 
38
                trackFile.write("original :" + line)
 
39
 
 
40
        line = file.readline()
 
41
        while (line) != "":
 
42
                backSlash = False
 
43
                
 
44
                if (line.find(dir_sources.replace('/','\\')) != -1):
 
45
                        backSlash = True
 
46
                        line = line.replace('\\','/')
 
47
                        if trackPrint:
 
48
                                trackFile.write("replace \\:" + line)
 
49
                pos = line.find(dir_sources)
 
50
                while (pos != -1):
 
51
                        #print "Line changed: " + line.lstrip()
 
52
                        rpos1 = findChar(line,"\"", pos)
 
53
                        rpos2 = findChar(line,"<", pos)
 
54
                        rpos3 = findChar(line,";", pos)
 
55
                        rpos = min(rpos1, min(rpos2, rpos3))
 
56
                        path = line[pos : rpos] #.replace('\\','/')
 
57
                        relpath = os.path.relpath(path, currentFolder).replace('\\','/')
 
58
                        #print path + " | " + relpath
 
59
                        
 
60
                        if trackPrint:
 
61
                                trackFile.write("relpath  :" + relpath + "\n")
 
62
                        
 
63
                        if (backSlash):
 
64
                                relpath = relpath.replace('/','\\')
 
65
                        line = line.replace(path, relpath, 1)
 
66
                        
 
67
                        if trackPrint:
 
68
                                trackFile.write("relpath \\:" + relpath + "\n")
 
69
                                trackFile.write("line unrel" + line)
 
70
                        
 
71
                        #print "to next line: " + line.lstrip()
 
72
                        
 
73
                        pos = line.find(dir_sources)
 
74
                
 
75
                line = line.replace("C:/MYGUIHACK ", "$(")
 
76
                line = line.replace("C:\\MYGUIHACK ", "$(")
 
77
                line = line.replace(" MYGUIBRACKETHACK", ")")
 
78
                
 
79
                if (line.find("cmake.exe") != -1 and line.find("CommandLine") != -1):
 
80
                        lpos = line.find("\"", 0)
 
81
                        rpos = line.find("\"", lpos + 1)
 
82
                        if (trackPrint):
 
83
                                trackFile.write("Remove cmake.exe: " + line)
 
84
                                trackFile.write("           lines: " + str(lpos) + " " + str(rpos) + "\n")
 
85
                                trackFile.write("        replaced: " + line.replace(line[lpos + 1 : rpos], ""))
 
86
                        line = line.replace(line[lpos + 1 : rpos], "")
 
87
                        stopParse = True
 
88
                
 
89
                alllines.append( line )
 
90
                line = file.readline()
 
91
 
 
92
        if trackPrint:
 
93
                trackFile.close()
 
94
 
 
95
        file = open(fileName,"w")
 
96
        #file = open(fileName + ".txt","w")
 
97
        file.writelines(alllines)
 
98
        file.close()
 
99
 
 
100
        del alllines[:]
 
101
 
 
102
def isIgnoredProject(name):
 
103
        #ignores = ["api-docs", "INSTALL", "ALL_BUILD", "ZERO_CHECK", "PACKAGE"]
 
104
        ignores = []
 
105
        for ignore in ignores:
 
106
                if name.startswith(ignore):
 
107
                        return True
 
108
        if name.endswith(".cmake") or name.endswith("tmp"):
 
109
                return True
 
110
        return False
 
111
 
 
112
# ----------
 
113
 
 
114
dir_sources = os.path.realpath(dir_sources)
 
115
dir_sources = dir_sources.replace('\\','/')
 
116
 
 
117
index = 0
 
118
for dir_release in directories_release:
 
119
        index = index+1
 
120
        os.system("mkdir " + dir_release)
 
121
        os.chdir(dir_release)
 
122
        os.system("cmake ../ -DMYGUI_RENDERSYSTEM=" + str(index) + " -DMYGUI_BUILD_UNITTESTS=True -DMYGUI_BUILD_WRAPPER=True -DMYGUI_STANDALONE_BUILD=True -DMYGUI_BUILD_DOCS=True")
 
123
        os.chdir("../Scripts")
 
124
        for root, dirs, files in os.walk(dir_release):
 
125
                for name in files:
 
126
                        if not isIgnoredProject(name):
 
127
                                
 
128
                                f_src = os.path.join(root, name)
 
129
                                f_src = f_src.replace('\\','/')
 
130
                                currentFolder = os.path.realpath(f_src)
 
131
                                currentFolder = currentFolder.replace(name, "")
 
132
                                currentFolder = currentFolder.replace('\\','/')
 
133
                                replaceAbsolutePaths(f_src)
 
134
 
135
135
print "Done"
 
 
b'\\ No newline at end of file'