-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Detect whether VC++ compiler can be found in configure.py #2086
Changes from 3 commits
87b8965
34d03bd
3ef318c
b5fa2d5
69fb2ce
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -305,7 +305,16 @@ def binary(name): | |
else: | ||
n.variable('ar', configure_env.get('AR', 'ar')) | ||
|
||
def SearchPath(exe_name): | ||
"""Find an executable (.exe, .bat, whatever) in the system path.""" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: The comment and naming used here suggest that this behaves like the Win32 SearchPath() function and will probe for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good point about the name and the comment. The function is OS-generic so I renamed it to search_system_path - it could be used on any OS, it just currently isn't. Thoughts? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for the name change, I would just mention that the function is not OS-generic though. I.e. on Unix you would want to use ':', not ';' for the split, and you would need to handle empty items, which translate to "search the current path" (and frequent source of conflict and security issues, happens all the time with LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/some/new/path, when LD_LIBRARY_PATH was empty, and now your library search path will always start in the current directory, boom). Please do not handle this here, but that's why There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good points. I could rename to search_windows_path, or leave it as-is. Fixing the path separator is easy enough (os.pathsep instead of ';', perhaps a worthwhile change anyway) but it sounds like it still wouldn't be truly generic. |
||
for dir in os.environ['path'].split(';'): | ||
path = os.path.join(dir, exe_name) | ||
if os.path.exists(path): | ||
return path | ||
|
||
if platform.is_msvc(): | ||
if not SearchPath('cl.exe'): | ||
raise Exception('cl.exe not found. Run again from the Developer Command Prompt for VS') | ||
cflags = ['/showIncludes', | ||
'/nologo', # Don't print startup banner. | ||
'/Zi', # Create pdb with debug info. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: rename this to
search_windows_path()
since this doesn't handle anything else and uses the same naming convention as the rest of this file.