Skip to content

Commit

Permalink
Find the VS provided Arm toolchain
Browse files Browse the repository at this point in the history
This is enough to find all the tools if you're running in a developer command prompt.
  • Loading branch information
Daft-Freak committed May 24, 2021
1 parent e867fa4 commit 8e5dc98
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/ttblit/tool/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,24 @@ def parse_args(self, ctx, args):

# command/name/required version
prereqs = [
(['git', '--version'], 'Git', None),
(['cmake', '--version'], 'CMake', [3, 9]),
(['arm-none-eabi-gcc', '--version'], 'GCC Arm Toolchain', [7, 3])
('git --version', 'Git', None),
('cmake --version', 'CMake', [3, 9]),
('arm-none-eabi-gcc --version', 'GCC Arm Toolchain', [7, 3])
]

# adjust path to dectct the VS Arm toolchain
path = os.getenv('PATH')
vs_dir = os.getenv('VSInstallDir')

if vs_dir:
path = ';'.join([path, vs_dir + 'Linux\\gcc_arm\\bin'])
print(path)

failed = False

for command, name, version in prereqs:
try:
result = subprocess.run(command, stdout=subprocess.PIPE, text=True)
result = subprocess.run(command, stdout=subprocess.PIPE, text=True, shell=True, env={'PATH': path})

version_str = ".".join([str(x) for x in version]) if version else 'any'
found_version_str = re.search(r'[0-9]+\.[0-9\.]+', result.stdout).group(0)
Expand Down

0 comments on commit 8e5dc98

Please sign in to comment.