[ create a new paste ] login | about

Link: http://codepad.org/FEC8WC2M    [ raw code | fork ]

C, pasted on May 11:
--- CubeMX2Makefile.py	Thu Apr  2 02:58:09 2015
+++ new.py	Mon May 11 18:38:17 2015
@@ -59,8 +59,8 @@
     sys.exit(C2M_ERR_INVALID_COMMANDLINE)
 
 proj_name = os.path.splitext(os.path.basename(proj_folder))[0]
-ts_project = proj_folder + os.path.sep + 'TrueSTUDIO' + os.path.sep + proj_name + ' Configuration' + os.path.sep + '.project'
-ts_cproject = proj_folder + os.path.sep + 'TrueSTUDIO' + os.path.sep + proj_name + ' Configuration' + os.path.sep + '.cproject'
+ts_project = proj_folder + os.path.sep + 'Projects' + os.path.sep + 'TrueSTUDIO' + os.path.sep + proj_name + ' Configuration' + os.path.sep + '.project'
+ts_cproject = proj_folder + os.path.sep + 'Projects' + os.path.sep + 'TrueSTUDIO' + os.path.sep + proj_name + ' Configuration' + os.path.sep + '.cproject'
 if not (os.path.isfile(ts_project) and os.path.isfile(ts_cproject)):
     sys.stderr.write("TrueSTUDIO project not found, use STM32CubeMX to generate a TrueSTUDIO project first\r\n")
     sys.exit(C2M_ERR_NO_PROJECT)
@@ -75,7 +75,7 @@
 nodes = root.findall('linkedResources/link[type=\'1\']/locationURI')
 sources = []
 for node in nodes:
-    sources.append(re.sub(r'^PARENT-2-PROJECT_LOC/', '', node.text))
+    sources.append(re.sub(r'^PARENT-3-PROJECT_LOC/', '', node.text))
 sources=list(set(sources))
 sources.sort()
 c_sources = 'C_SOURCES ='
@@ -118,7 +118,7 @@
 for node in nodes:
     value = node.attrib.get('value')
     if (value != ""):
-        value = re.sub(r'^..(\\|/)..(\\|/)..(\\|/)', '', value.replace('\\', os.path.sep))
+        value = re.sub(r'^..(\\|/)..(\\|/)', '', value.replace('\\', '/'))
         if first:
             as_includes = 'AS_INCLUDES = -I' + value
             first = 0
@@ -138,7 +138,7 @@
 for node in nodes:
     value = node.attrib.get('value')
     if (value != ""):
-        value = re.sub(r'^..(\\|/)..(\\|/)..(\\|/)', '', value.replace('\\', os.path.sep))
+        value = re.sub(r'^..(\\|/)..(\\|/)..(\\|/)..(\\|/)', '', value.replace('\\', '/'))
         if first:
             c_includes = 'C_INCLUDES = -I' + value
             first = 0
@@ -150,7 +150,7 @@
 for node in nodes:
     value = node.attrib.get('value')
     if (value != ""):
-        c_defs += ' -D' + value
+        c_defs += ' \"-D' + value + "\""
 
 # Link script
 memory = ''
@@ -158,7 +158,7 @@
 node = root.find('.//tool[@superClass="com.atollic.truestudio.exe.debug.toolchain.ld"]/option[@superClass="com.atollic.truestudio.ld.general.scriptfile"]')
 try:
     value = node.attrib.get('value')
-    ld_script = proj_folder + os.path.sep + 'TrueSTUDIO' + os.path.sep + proj_name + ' Configuration' + os.path.sep + os.path.basename(value.replace('\\', os.path.sep))
+    ld_script = proj_folder + os.path.sep + 'Projects' + os.path.sep + 'TrueSTUDIO' + os.path.sep + proj_name + ' Configuration' + os.path.sep + os.path.basename(value.replace('\\', os.path.sep))
     fd = open(ld_script, 'r')
     ls = fd.read()
     fd.close()


Create a new paste based on this one


Comments: