MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / UpdateProjectStructure

Function UpdateProjectStructure

tools/targets/eclipse.py:359–389  ·  view source on GitHub ↗
(env, prj_name)

Source from the content-addressed store, hash-verified

357
358
359def UpdateProjectStructure(env, prj_name):
360 bsp_root = env['BSP_ROOT']
361 rtt_root = env['RTT_ROOT']
362
363 project = etree.parse('.project')
364 root = project.getroot()
365
366 if rtt_root.startswith(bsp_root):
367 linkedResources = root.find('linkedResources')
368 if linkedResources == None:
369 linkedResources = SubElement(root, 'linkedResources')
370
371 links = linkedResources.findall('link')
372 # delete all RT-Thread folder links
373 for link in links:
374 if link.find('name').text.startswith('rt-thread'):
375 linkedResources.remove(link)
376
377 if prj_name:
378 name = root.find('name')
379 if name == None:
380 name = SubElement(root, 'name')
381 name.text = prj_name
382
383 out = open('.project', 'w')
384 out.write('<?xml version="1.0" encoding="UTF-8"?>\n')
385 xml_indent(root)
386 out.write(etree.tostring(root, encoding='utf-8').decode('utf-8'))
387 out.close()
388
389 return
390
391
392def GenExcluding(env, project):

Callers 1

TargetEclipseFunction · 0.85

Calls 3

xml_indentFunction · 0.90
openFunction · 0.50
writeMethod · 0.45

Tested by

no test coverage detected