Skip to content

Commit c15fe76

Browse files
mndeveciCoshUSsriram-mv
authored
Merging new features to master branch (#196)
* Added Dynamic Encoding Selection Based on Windows System Default * Fixed dotnet output system dependent encoding * Updated test_custom_make urllib3 Version * Reformatted with black * Rollback Changes to popen for Python 2 Support * Added Doc Page for DotNet Output Encoding * fix(ruby): use stdout stream to raise exceptions from bundler - relevant error information is in stdout instead of stderr for bundler. * chore: bump version to 1.1.0 Co-authored-by: Wilton Wang <[email protected]> Co-authored-by: Sriram Madapusi Vasudevan <[email protected]> Co-authored-by: Sriram Madapusi Vasudevan <[email protected]>
1 parent a943b1a commit c15fe76

File tree

6 files changed

+14
-7
lines changed

6 files changed

+14
-7
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ typings/
187187
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
188188

189189
# User-specific stuff:
190+
.vscode
190191

191192
# Sensitive or high-churn files:
192193

aws_lambda_builders/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
22
AWS Lambda Builder Library
33
"""
4-
__version__ = "1.0.0"
4+
__version__ = "1.1.0"
55
RPC_PROTOCOL_VERSION = "0.3"

aws_lambda_builders/workflows/dotnet_clipackage/dotnetcli.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
import sys
66
import logging
7+
import locale
78

89
from .utils import OSUtils
910

@@ -49,14 +50,18 @@ def run(self, args, cwd=None):
4950

5051
LOG.debug("executing dotnet: %s", invoke_dotnet)
5152

53+
# DotNet output is in system locale dependent encoding
54+
# https://docs.microsoft.com/en-us/dotnet/api/system.console.outputencoding?view=netcore-3.1#remarks
55+
# "The default code page that the console uses is determined by the system locale."
56+
encoding = locale.getpreferredencoding()
5257
p = self.os_utils.popen(invoke_dotnet, stdout=self.os_utils.pipe, stderr=self.os_utils.pipe, cwd=cwd)
5358

5459
out, err = p.communicate()
5560

5661
# The package command contains lots of useful information on how the package was created and
5762
# information when the package command was not successful. For that reason the output is
5863
# always written to the output to help developers diagnose issues.
59-
LOG.info(out.decode("utf8").strip())
64+
LOG.info(out.decode(encoding).strip())
6065

6166
if p.returncode != 0:
62-
raise DotnetCLIExecutionError(message=err.decode("utf8").strip())
67+
raise DotnetCLIExecutionError(message=err.decode(encoding).strip())

aws_lambda_builders/workflows/ruby_bundler/bundler.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,10 @@ def run(self, args, cwd=None):
4848

4949
p = self.osutils.popen(invoke_bundler, stdout=self.osutils.pipe, stderr=self.osutils.pipe, cwd=cwd)
5050

51-
out, err = p.communicate()
51+
out, _ = p.communicate()
5252

5353
if p.returncode != 0:
54-
raise BundlerExecutionError(message=err.decode("utf8").strip())
54+
# Bundler has relevant information in stdout, not stderr.
55+
raise BundlerExecutionError(message=out.decode("utf8").strip())
5556

5657
return out.decode("utf8").strip()

tests/integration/workflows/custom_make/test_custom_make.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def test_must_build_python_project_through_makefile(self):
4444
"chardet",
4545
"urllib3",
4646
"idna",
47-
"urllib3-1.25.9.dist-info",
47+
"urllib3-1.25.10.dist-info",
4848
"chardet-3.0.4.dist-info",
4949
"certifi-2020.4.5.2.dist-info",
5050
"certifi",

tests/unit/workflows/ruby_bundler/test_bundler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def test_returns_popen_out_decoded_if_retcode_is_0(self):
5858

5959
def test_raises_BundlerExecutionError_with_err_text_if_retcode_is_not_0(self):
6060
self.popen.returncode = 1
61-
self.popen.err = b"some error text\n\n"
61+
self.popen.out = b"some error text\n\n"
6262
with self.assertRaises(BundlerExecutionError) as raised:
6363
self.under_test.run(["install", "--without", "development", "test"])
6464
self.assertEqual(raised.exception.args[0], "Bundler Failed: some error text")

0 commit comments

Comments
 (0)