Py3: make fcbt scripts working
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import os, sys, re,string,FCFileTools
|
||||
import os, sys, re,FCFileTools
|
||||
verbose = 0
|
||||
dcount = fcount = 0
|
||||
|
||||
@@ -16,8 +16,8 @@ def replaceTemplate(dirName, oldName, newName):
|
||||
origFile.close() # ... and close it
|
||||
output = open(pathName,"w") # open the file again
|
||||
for line in lines:
|
||||
if (string.find(line, oldName) != -1): # search for 'oldName' and replace it
|
||||
line = string.replace(line, oldName, newName)
|
||||
if (line.find(oldName) != -1): # search for 'oldName' and replace it
|
||||
line = line.replace(oldName, newName)
|
||||
output.write(line) # write the modified line back
|
||||
output.close # close the file
|
||||
except:
|
||||
@@ -40,8 +40,8 @@ def copyTemplate(dirFrom, dirTo, oldName, newName, MatchFile, MatchDir):
|
||||
print(file)
|
||||
pathFrom = os.path.join(dirFrom, file)
|
||||
pathTo = os.path.join(dirTo, file) # extend both paths
|
||||
if (string.find(pathTo, oldName) != -1):
|
||||
pathTo = string.replace(pathTo, oldName, newName) # rename file if 'oldName' is found
|
||||
if (pathTo.find(oldName) != -1):
|
||||
pathTo = pathTo.replace(oldName, newName) # rename file if 'oldName' is found
|
||||
if not os.path.isdir(pathFrom): # copy simple files
|
||||
hit = 0
|
||||
for matchpat in MatchFile:
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
# (c) 2004 Juergen Riegel
|
||||
|
||||
|
||||
import os,sys,string
|
||||
import os,sys
|
||||
|
||||
help1 = """
|
||||
FreeCAD Build Tool
|
||||
@@ -27,11 +27,12 @@ For help on the modules type:
|
||||
if(len(sys.argv) < 2):
|
||||
sys.stdout.write(help1)
|
||||
sys.stdout.write("Insert command: ")
|
||||
sys.stdout.flush()
|
||||
CmdRaw = sys.stdin.readline()[:-1]
|
||||
else:
|
||||
CmdRaw = sys.argv[1]
|
||||
|
||||
Cmd = string.lower(CmdRaw)
|
||||
Cmd = CmdRaw.lower()
|
||||
|
||||
|
||||
if Cmd == "distsrc" or Cmd == "ds" :
|
||||
@@ -58,7 +59,3 @@ else:
|
||||
print(CmdRaw + " is an unknown command!\n")
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ import MakeAppTools
|
||||
import re
|
||||
|
||||
FilFilter = ["^.*\\.o$",
|
||||
"^.*\\Makefile$",
|
||||
"^.*Makefile$",
|
||||
"^.*\\.la$",
|
||||
"^.*\\.lo$",
|
||||
"^.*\\.positions$",
|
||||
@@ -116,6 +116,7 @@ def validateApp(AppName):
|
||||
sys.exit()
|
||||
|
||||
sys.stdout.write("Please enter a name for your application:")
|
||||
sys.stdout.flush()
|
||||
AppName = sys.stdin.readline()[:-1]
|
||||
validateApp(AppName)
|
||||
createApp(AppName)
|
||||
|
||||
Reference in New Issue
Block a user