diff options
author | Michael Kubacki <michael.kubacki@microsoft.com> | 2024-12-12 22:37:58 -0500 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2024-12-19 00:19:13 +0000 |
commit | 260d36484dbf7eec0a05dafff253692318125ac5 (patch) | |
tree | fbdfbc098b1fa55e4a83a4911a43f359ab3007a0 | |
parent | b8602d8fee6d6cf2665aa4b7f86b8154c70c2952 (diff) | |
download | edk2-260d36484dbf7eec0a05dafff253692318125ac5.tar.gz |
.pytool/LicenseCheck: Open files in utf-8
The LicenseCheck plugin currently fails if a file contains characters
outside the platform-dependent encoding returned from
locale.getencoding().
This change updates the encoding to utf-8 so the plugin is more
robust while continuing to support backward compatibility with the
ASCII range.
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
-rw-r--r-- | .pytool/Plugin/LicenseCheck/LicenseCheck.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/.pytool/Plugin/LicenseCheck/LicenseCheck.py b/.pytool/Plugin/LicenseCheck/LicenseCheck.py index 7b998daf6f..9e596bb083 100644 --- a/.pytool/Plugin/LicenseCheck/LicenseCheck.py +++ b/.pytool/Plugin/LicenseCheck/LicenseCheck.py @@ -70,7 +70,7 @@ class LicenseCheck(ICiBuildPlugin): temp_diff_output = os.path.join (temp_path, 'diff.txt')
params = "diff --output={} --unified=0 origin/master HEAD".format(temp_diff_output)
RunCmd("git", params)
- with open(temp_diff_output) as file:
+ with open(temp_diff_output, encoding='utf8') as file:
patch = file.read().strip().split("\n")
# Delete temp directory
if os.path.exists(temp_path):
|