index = 0
for i, property in param_list:
if "type" in configurations[property]["informations"] and configurations[property]["informations"]["type"] == "autoenabled":
index = 0
for i, property in param_list:
if "type" in configurations[property]["informations"] and configurations[property]["informations"]["type"] == "autoenabled":
- ## Doesn't show the hidden fields
+ # Doesn't show the hidden fields
- ## Set the row count to the current index + 1
+ # Set the row count to the current index + 1
self.pageContent.propertyTable.setRowCount(index + 1)
item = QTableWidgetItem(configurations[property]["brief"])
item.setData(Qt.UserRole, qvariant_converter.convertString(property))
self.pageContent.propertyTable.setRowCount(index + 1)
item = QTableWidgetItem(configurations[property]["brief"])
item.setData(Qt.UserRole, qvariant_converter.convertString(property))
"""
Loads the module data.
"""
"""
Loads the module data.
"""
- ## Load the module data only if it isn't already loaded
+ # Load the module data only if it isn't already loaded
if self.projectInfo("MODULES") == None \
and self.projectInfo("LISTS") == None \
and self.projectInfo("CONFIGURATIONS") == None:
if self.projectInfo("MODULES") == None \
and self.projectInfo("LISTS") == None \
and self.projectInfo("CONFIGURATIONS") == None:
Inserts in the table at index a spinbox for an int, a long or an unsigned
long property setted to value.
"""
Inserts in the table at index a spinbox for an int, a long or an unsigned
long property setted to value.
"""
- ## int, long or undefined type property
+ # int, long or undefined type property
spin_box = None
if bertos_utils.isLong(informations) or bertos_utils.isUnsignedLong(informations):
spin_box = QDoubleSpinBox()
spin_box = None
if bertos_utils.isLong(informations) or bertos_utils.isUnsignedLong(informations):
spin_box = QDoubleSpinBox()
filename = qvariant_converter.getStringDict(self.pageContent.toolchainList.item(i).data(Qt.UserRole))["path"]
valid = False
info = {}
filename = qvariant_converter.getStringDict(self.pageContent.toolchainList.item(i).data(Qt.UserRole))["path"]
valid = False
info = {}
- ## Check for the other tools of the toolchain
+ # Check for the other tools of the toolchain
for tool in TOOLCHAIN_ITEMS:
if os.path.exists(filename.replace("gcc", tool)):
valid = True
else:
valid = False
break
for tool in TOOLCHAIN_ITEMS:
if os.path.exists(filename.replace("gcc", tool)):
valid = True
else:
valid = False
break
- ## Try to retrieve the informations about the toolchain only for the valid toolchains
+ # Try to retrieve the informations about the toolchain only for the valid toolchains
if valid:
self._validation_process = QProcess()
self._validation_process.start(filename, ["-v"])
if valid:
self._validation_process = QProcess()
self._validation_process.start(filename, ["-v"])
valid = True
else:
self._validation_process.kill()
valid = True
else:
self._validation_process.kill()
- ## Add the item in the list with the appropriate associate data.
+ # Add the item in the list with the appropriate associate data.
if valid:
self._validItem(i, info)
else:
if valid:
self._validItem(i, info)
else:
"""
if self.pageContent.versionList.currentRow() != -1:
sources_path = qvariant_converter.getString(self.pageContent.versionList.currentItem().data(Qt.UserRole))
"""
if self.pageContent.versionList.currentRow() != -1:
sources_path = qvariant_converter.getString(self.pageContent.versionList.currentItem().data(Qt.UserRole))
- ## Remove the trailing slash
+ # Remove the trailing slash
if sources_path.endswith(os.sep):
sources_path = sources_path[:-1]
self.setProjectInfo("SOURCES_PATH", sources_path)
if sources_path.endswith(os.sep):
sources_path = sources_path[:-1]
self.setProjectInfo("SOURCES_PATH", sources_path)
app = QApplication(sys.argv)
app.settings = QSettings("Develer", "Bertos Configurator")
app.project = BProject.BProject()
app = QApplication(sys.argv)
app.settings = QSettings("Develer", "Bertos Configurator")
app.project = BProject.BProject()
- ## Development utility lines, to be removed for production
+ # Development utility lines, to be removed for production
if newer("bertos.qrc", "bertos.rcc"):
os.system("rcc -binary bertos.qrc -o bertos.rcc")
QResource.registerResource("bertos.rcc")
if newer("bertos.qrc", "bertos.rcc"):
os.system("rcc -binary bertos.qrc -o bertos.rcc")
QResource.registerResource("bertos.rcc")
elif "--edit" in sys.argv and "--create" not in sys.argv:
editProject()
elif "--create" in sys.argv and "--edit" in sys.argv:
elif "--edit" in sys.argv and "--create" not in sys.argv:
editProject()
elif "--create" in sys.argv and "--edit" in sys.argv:
- ## TODO: need an explaining message
+ # TODO need an explaining message
print " ".join(sys.argv)
print "Invalid usage!"
pass
print " ".join(sys.argv)
print "Invalid usage!"
pass
f = open(directory + "/project.bertos", "w")
f.write(pickle.dumps(project_info))
f.close()
f = open(directory + "/project.bertos", "w")
f.write(pickle.dumps(project_info))
f.close()
- ## Destination source dir
+ # Destination source dir
srcdir = directory + "/bertos"
shutil.rmtree(srcdir, True)
shutil.copytree(sources_dir + "/bertos", srcdir)
srcdir = directory + "/bertos"
shutil.rmtree(srcdir, True)
shutil.copytree(sources_dir + "/bertos", srcdir)
- ## Destination makefile
makefile = directory + "/Makefile"
if os.path.exists(makefile):
os.remove(makefile)
makefile = open("mktemplates/Makefile").read()
makefile = makefileGenerator(project_info, makefile)
open(directory + "/Makefile", "w").write(makefile)
makefile = directory + "/Makefile"
if os.path.exists(makefile):
os.remove(makefile)
makefile = open("mktemplates/Makefile").read()
makefile = makefileGenerator(project_info, makefile)
open(directory + "/Makefile", "w").write(makefile)
- ## Destination project dir
+ # Destination project dir
prjdir = directory + "/" + os.path.basename(directory)
shutil.rmtree(prjdir, True)
os.mkdir(prjdir)
prjdir = directory + "/" + os.path.basename(directory)
shutil.rmtree(prjdir, True)
os.mkdir(prjdir)
- ## Destination configurations files
+ # Destination configurations files
cfgdir = prjdir + "/cfg"
shutil.rmtree(cfgdir, True)
os.mkdir(cfgdir)
cfgdir = prjdir + "/cfg"
shutil.rmtree(cfgdir, True)
os.mkdir(cfgdir)
f = open(cfgdir + "/" + os.path.basename(configuration), "w")
f.write(string)
f.close()
f = open(cfgdir + "/" + os.path.basename(configuration), "w")
f.write(string)
f.close()
makefile = open("mktemplates/template.mk", "r").read()
makefile = mkGenerator(project_info, makefile)
open(prjdir + "/" + os.path.basename(prjdir) + ".mk", "w").write(makefile)
makefile = open("mktemplates/template.mk", "r").read()
makefile = mkGenerator(project_info, makefile)
open(prjdir + "/" + os.path.basename(prjdir) + ".mk", "w").write(makefile)
- ## Destination main.c file
+ # Destination main.c file
main = open("srctemplates/main.c", "r").read()
open(prjdir + "/main.c", "w").write(main)
main = open("srctemplates/main.c", "r").read()
open(prjdir + "/main.c", "w").write(main)
- ## Codelite project files
+ # Codelite project files
if "codelite" in project_info.info("OUTPUT"):
codelite_project.createProject(project_info)
if "codelite" in project_info.info("OUTPUT"):
codelite_project.createProject(project_info)
"""
Generate the Makefile for the current project.
"""
"""
Generate the Makefile for the current project.
"""
- # TODO: write a general function that works for both the mk file and the Makefile
+ # TODO write a general function that works for both the mk file and the Makefile
while makefile.find("project_name") != -1:
makefile = makefile.replace("project_name", os.path.basename(project_info.info("PROJECT_PATH")))
return makefile
while makefile.find("project_name") != -1:
makefile = makefile.replace("project_name", os.path.basename(project_info.info("PROJECT_PATH")))
return makefile
harvard = True
else:
harvard = False
harvard = True
else:
harvard = False
- ## file to be included in CSRC variable
+ # file to be included in CSRC variable
- ## file to be included in PCSRC variable
+ # file to be included in PCSRC variable
- ## files to be included in CPPASRC variable
+ # files to be included in CPPASRC variable
- ## constants to be included at the beginning of the makefile
+ # constants to be included at the beginning of the makefile
constants = {}
for module, information in modules.items():
module_files = set([])
dependency_files = set([])
constants = {}
for module, information in modules.items():
module_files = set([])
dependency_files = set([])
asm_files = set([])
if information["enabled"]:
if "constants" in information:
asm_files = set([])
if information["enabled"]:
if "constants" in information:
return csrc, pcsrc, asrc, constants
def findModuleFiles(module, project_info):
return csrc, pcsrc, asrc, constants
def findModuleFiles(module, project_info):
- ## Find the files related to the selected module
+ # Find the files related to the selected module
- ## .c files related to the module and the cpu architecture
+ # .c files related to the module and the cpu architecture
for filename, path in findDefinitions(module + ".c", project_info) + \
findDefinitions(module + "_" + project_info.info("CPU_INFOS")["TOOLCHAIN"] + ".c", project_info):
path = path.replace(project_info.info("SOURCES_PATH") + "/", "")
cfiles.append(path + "/" + filename)
for filename, path in findDefinitions(module + ".c", project_info) + \
findDefinitions(module + "_" + project_info.info("CPU_INFOS")["TOOLCHAIN"] + ".c", project_info):
path = path.replace(project_info.info("SOURCES_PATH") + "/", "")
cfiles.append(path + "/" + filename)
- ## .s files related to the module and the cpu architecture
+ # .s files related to the module and the cpu architecture
for filename, path in findDefinitions(module + ".s", project_info) + \
findDefinitions(module + "_" + project_info.info("CPU_INFOS")["TOOLCHAIN"] + ".s", project_info) + \
findDefinitions(module + ".S", project_info) + \
findDefinitions(module + "_" + project_info.info("CPU_INFOS")["TOOLCHAIN"] + ".S", project_info):
path = path.replace(project_info.info("SOURCES_PATH") + "/", "")
sfiles.append(path + "/" + filename)
for filename, path in findDefinitions(module + ".s", project_info) + \
findDefinitions(module + "_" + project_info.info("CPU_INFOS")["TOOLCHAIN"] + ".s", project_info) + \
findDefinitions(module + ".S", project_info) + \
findDefinitions(module + "_" + project_info.info("CPU_INFOS")["TOOLCHAIN"] + ".S", project_info):
path = path.replace(project_info.info("SOURCES_PATH") + "/", "")
sfiles.append(path + "/" + filename)
- ## .c and .s files related to the module and the cpu tags
+ # .c and .s files related to the module and the cpu tags
for tag in project_info.info("CPU_INFOS")["CPU_TAGS"]:
for filename, path in findDefinitions(module + "_" + tag + ".c", project_info):
path = path.replace(project_info.info("SOURCES_PATH") + "/", "")
for tag in project_info.info("CPU_INFOS")["CPU_TAGS"]:
for filename, path in findDefinitions(module + "_" + tag + ".c", project_info):
path = path.replace(project_info.info("SOURCES_PATH") + "/", "")