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

Function ARMCC_Version

tools/targets/keil.py:476–513  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

474 project.close()
475
476def ARMCC_Version():
477 import rtconfig
478 import subprocess
479 import re
480
481 path = rtconfig.EXEC_PATH
482 if(rtconfig.PLATFORM == 'armcc'):
483 path = os.path.join(path, 'armcc.exe')
484 elif(rtconfig.PLATFORM == 'armclang'):
485 path = os.path.join(path, 'armlink.exe')
486
487 if os.path.exists(path):
488 cmd = path
489 else:
490 return "0.0"
491
492 child = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
493 stdout, stderr = child.communicate()
494
495 '''
496 example stdout:
497 Product: MDK Plus 5.24
498 Component: ARM Compiler 5.06 update 5 (build 528)
499 Tool: armcc [4d3621]
500
501 return version: MDK Plus 5.24/ARM Compiler 5.06 update 5 (build 528)/armcc [4d3621]
502 '''
503 if not isinstance(stdout, str):
504 stdout = str(stdout, 'utf8') # Patch for Python 3
505 version_Product = re.search(r'Product: (.+)', stdout).group(1)
506 version_Product = version_Product[:-1]
507 version_Component = re.search(r'Component: (.*)', stdout).group(1)
508 version_Component = version_Component[:-1]
509 version_Tool = re.search(r'Tool: (.*)', stdout).group(1)
510 version_Tool = version_Tool[:-1]
511 version_str_format = '%s/%s/%s'
512 version_str = version_str_format % (version_Product, version_Component, version_Tool)
513 return version_str

Callers 1

GenTargetProjectFunction · 0.90

Calls 1

joinMethod · 0.45

Tested by

no test coverage detected