()
| 190 | return path |
| 191 | |
| 192 | def IARVersion(): |
| 193 | import subprocess |
| 194 | import re |
| 195 | |
| 196 | path = IARPath() |
| 197 | |
| 198 | if os.path.exists(path): |
| 199 | cmd = os.path.join(path, 'iccarm.exe') |
| 200 | else: |
| 201 | return "0.0" |
| 202 | |
| 203 | child = subprocess.Popen([cmd, '--version'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True) |
| 204 | stdout, stderr = child.communicate() |
| 205 | if not isinstance(stdout, str): |
| 206 | stdout = str(stdout, 'utf8') # Patch for Python 3 |
| 207 | # example stdout: IAR ANSI C/C++ Compiler V8.20.1.14183/W32 for ARM |
| 208 | iar_version = re.search(r'[\d\.]+', stdout).group(0) |
| 209 | return iar_version |
no test coverage detected