Returns "15, path" based on the result of invoking vswhere.exe If no install is found, returns "None, None" The version is returned to avoid unnecessarily changing the function result. It may be ignored when the path is not None. If vswhere.exe is not available, by definition, VS 2
()
| 52 | return best_version, best_dir |
| 53 | |
| 54 | def _find_vc2017(): |
| 55 | """Returns "15, path" based on the result of invoking vswhere.exe |
| 56 | If no install is found, returns "None, None" |
| 57 | |
| 58 | The version is returned to avoid unnecessarily changing the function |
| 59 | result. It may be ignored when the path is not None. |
| 60 | |
| 61 | If vswhere.exe is not available, by definition, VS 2017 is not |
| 62 | installed. |
| 63 | """ |
| 64 | root = os.environ.get("ProgramFiles(x86)") or os.environ.get("ProgramFiles") |
| 65 | if not root: |
| 66 | return None, None |
| 67 | |
| 68 | try: |
| 69 | path = subprocess.check_output([ |
| 70 | os.path.join(root, "Microsoft Visual Studio", "Installer", "vswhere.exe"), |
| 71 | "-latest", |
| 72 | "-prerelease", |
| 73 | "-requires", "Microsoft.VisualStudio.Component.VC.Tools.x86.x64", |
| 74 | "-property", "installationPath", |
| 75 | "-products", "*", |
| 76 | ], encoding="mbcs", errors="strict").strip() |
| 77 | except (subprocess.CalledProcessError, OSError, UnicodeDecodeError): |
| 78 | return None, None |
| 79 | |
| 80 | path = os.path.join(path, "VC", "Auxiliary", "Build") |
| 81 | if os.path.isdir(path): |
| 82 | return 15, path |
| 83 | |
| 84 | return None, None |
| 85 | |
| 86 | PLAT_SPEC_TO_RUNTIME = { |
| 87 | 'x86' : 'x86', |
no test coverage detected
searching dependent graphs…