summarylogtreecommitdiffstats
path: root/0001-bazel-adapt-cc_wraper.py-to-python3-7519.patch
blob: 85b622c7ff237a38f273d5f67a3d961ef542070c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
From 74e348720af8d157bbdb00b629ac7c6022606fc8 Mon Sep 17 00:00:00 2001
From: Dmitry Rozhkov <dmitry.rojkov@gmail.com>
Date: Thu, 11 Jul 2019 23:27:19 +0300
Subject: [PATCH] bazel: adapt cc_wraper.py to python3 (#7519)

In Arch and Clear linux /usr/bin/python points to python3 causing
build failures due to type mismatch in os.write(): string is used
where bytestring is expected.
Explicitly convert string to bytestring.

Risk Level: low
Testing: unit tests
Release Notes: N/A
Documentation: N/A

Signed-off-by: Dmitry Rozhkov <dmitry.rozhkov@linux.intel.com>
---
 bazel/cc_wrapper.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/bazel/cc_wrapper.py b/bazel/cc_wrapper.py
index 53037e67b..41029a05e 100755
--- a/bazel/cc_wrapper.py
+++ b/bazel/cc_wrapper.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3
 import contextlib
 import os
 import shlex
@@ -112,7 +112,7 @@ def main():
 
     with closing_fd(new_flagfile_fd):
       for arg in new_driver_args:
-        os.write(new_flagfile_fd, arg + "\n")
+        os.write(new_flagfile_fd, bytes(str(arg + "\n").encode("utf-8")))
 
     # Provide new arguments using the temp file containing the args
     new_args = ["@" + new_flagfile_path]
-- 
2.22.0