-
Notifications
You must be signed in to change notification settings - Fork 152
fix: helpful error messages when runtime mismatch for build #37
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
Changes from all commits
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 |
|---|---|---|
|
|
@@ -17,6 +17,7 @@ def validate_python_cmd(required_language, required_runtime_version): | |
| "python", | ||
| "-c", | ||
| "import sys; " | ||
| "sys.stdout.write('python' + str(sys.version_info.major) + '.' + str(sys.version_info.minor)); " | ||
| "assert sys.version_info.major == {major} " | ||
| "and sys.version_info.minor == {minor}".format( | ||
| major=major, | ||
|
|
@@ -63,10 +64,11 @@ def validate_runtime(cls, required_language, required_runtime): | |
| p = subprocess.Popen(cmd, | ||
| cwd=os.getcwd(), | ||
| stdout=subprocess.PIPE, stderr=subprocess.PIPE) | ||
| p.communicate() | ||
| found_runtime, _ = p.communicate() | ||
| if p.returncode != 0: | ||
| raise MisMatchRuntimeError(language=required_language, | ||
| required_runtime=required_runtime) | ||
| required_runtime=required_runtime, | ||
| found_runtime=str(found_runtime.decode('utf-8'))) | ||
|
Contributor
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. Is the decode valid in python2.7?
Contributor
Author
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. checked it with an integ test, and ran it under python2. under python2, even if its already string and we decode. we get to unicode.
Contributor
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. perfect |
||
| else: | ||
| LOG.warning("'%s' runtime has not " | ||
| "been validated!", required_language) | ||
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.
haha neat ;)