skia2/gn/find_msvc.py
Hal Canary 389c8e9d2d [minor] mark scripts as executable
if a filename ends with `.py` and  the file begins with '#!.*python.*',
make it executable.

Change-Id: I41de516ff37343d3b0979bde9fd61813aec7365c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/254439
Commit-Queue: Hal Canary <halcanary@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
Auto-Submit: Hal Canary <halcanary@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2019-11-21 17:06:27 +00:00

27 lines
776 B
Python
Executable File

#!/usr/bin/env python
# Copyright 2019 Google Inc.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
import sys
'''
Look for the first match in the format
C:\\Program Files (x86)\\Microsoft Visual Studio\\${RELEASE}\\${VERSION}\\VC
'''
def find_msvc():
if sys.platform.startswith('win'):
default_dir = r'C:\Program Files (x86)\Microsoft Visual Studio'
for release in ['2019', '2017']:
for version in ['Enterprise', 'Professional', 'Community', 'BuildTools']:
path = os.path.join(default_dir, release, version, 'VC')
if os.path.isdir(path):
return path
return None
if __name__ == '__main__':
result = find_msvc()
if result:
sys.stdout.write(result + '\n')