gyp: show descriptive Windows SDK detection error

When building with Visual Studio 2017, gyp may fail with a
non-descriptive message if Windows has stale registry keys for a
version of Windows SDK that was previously uninstalled.

This commit adds a specific warning message when the directory for
a detected SDK version doesn't exist and adds some Fixes to avoid
Python crashes that were blocking the detection of other SDK
versions:

- Only try to run listdir on a path if it exists and is a dir.

- Avoid accessing names[0] if it has no elements.

- Use %s instead of %o to print compatible_sdks (to avoid TypeError,
since %o is the octal number format specifier in Python and %s can be
used as a generic format specifier for objects).

Refs: https://github.com/nodejs/node/pull/14597
Bug: https://github.com/nodejs/node/issues/14103
Change-Id: Ifd50fe239f65b7b4a2d69c1c02038bada03066cb
Reviewed-on: https://chromium-review.googlesource.com/602133
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
1 file changed
tree: fb4c42492824c2a29fc9d7c69a293e8547a2fcd8
  1. buildbot/
  2. data/
  3. infra/
  4. pylib/
  5. samples/
  6. test/
  7. tools/
  8. .gitignore
  9. AUTHORS
  10. codereview.settings
  11. DEPS
  12. gyp
  13. gyp.bat
  14. gyp_main.py
  15. gyptest.py
  16. LICENSE
  17. OWNERS
  18. PRESUBMIT.py
  19. README.md
  20. setup.py
README.md

GYP can Generate Your Projects.

Documents are available at gyp.gsrc.io, or you can check out md-pages branch to read those documents offline.