1
# FreeCAD MakeNewBuildNbr script
4
# Creates a new application
6
# ***************************************************************************
7
# * (c) Werner Mayer (werner.wm.mayer@gmx.de) 2003 *
9
# * This file is part of the FreeCAD CAx development system. *
11
# * This program is free software; you can redistribute it and/or modify *
12
# * it under the terms of the GNU Lesser General Public License (LGPL) *
13
# * as published by the Free Software Foundation; either version 2 of *
14
# * the License, or (at your option) any later version. *
15
# * for detail see the LICENCE text file. *
17
# * FreeCAD is distributed in the hope that it will be useful, *
18
# * but WITHOUT ANY WARRANTY; without even the implied warranty of *
19
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
20
# * GNU Lesser General Public License for more details. *
22
# * You should have received a copy of the GNU Library General Public *
23
# * License along with FreeCAD; if not, write to the Free Software *
24
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
27
# * Werner Mayer 2003 *
28
# ***************************************************************************
71
def SetupFilter(MatchList):
73
for regexp in MatchList:
74
a = re.compile(regexp)
79
def createApp(Application):
81
Create a new application by copying the template
83
# create directory ../Mod/<Application>
84
if not os.path.isdir("../Mod/" + Application):
85
os.mkdir("../Mod/" + Application)
87
sys.stdout.write(Application + " already exists. Please enter another name.\n")
90
# copying files from _TEMPLATE_ to ../Mod/<Application>
91
sys.stdout.write("Copying files...")
92
MakeAppTools.copyTemplate(
94
"../Mod/" + Application,
97
SetupFilter(FilFilter),
98
SetupFilter(DirFilter),
100
sys.stdout.write("Ok\n")
102
# replace the _TEMPLATE_ string by <Application>
103
sys.stdout.write("Modifying files...\n")
104
MakeAppTools.replaceTemplate("../Mod/" + Application, "_TEMPLATE_", Application)
105
MakeAppTools.replaceTemplate(
106
"../Mod/" + Application,
107
"${CMAKE_SOURCE_DIR}/src/Tools/",
108
"${CMAKE_SOURCE_DIR}/src/Mod/",
110
# make the configure script executable
111
# os.chmod("../Mod/" + Application + "/configure", 0777);
112
sys.stdout.write("Modifying files done.\n")
114
sys.stdout.write(Application + " module created successfully.\n")
117
def validateApp(AppName):
119
Validates the class name
122
sys.stdout.write("Too short name: '" + AppName + "'\n")
124
# name is long enough
125
clName = "class " + AppName + ": self=0"
130
sys.stdout.write("Invalid name: '" + AppName + "'\n")
134
sys.stdout.write("Please enter a name for your application:")
136
AppName = sys.stdin.readline()[:-1]