4 Commits

Author SHA1 Message Date
Joel Brobecker
acb1c3aa2a encode_utf8: Remove Python-2.x-only code
According to the function's documentation, we weren't planning
on keeping this function at all once the transition was complete,
but in thinking more about this, it seems prudent to keep it
nonetheless. The function's description has been rewritten to
explain why.

Change-Id: I60c83ab1846e969866ad67e3106eb6bfa4e77ea2
TN: U530-006
2021-11-30 17:41:32 +04:00
Joel Brobecker
56acb90821 safe_decode: Remove Python-2.x-only code
Now that Python 3.x is required, we no longer need to keep
some of the code in this function which was only run when
using Python 3.x.

Change-Id: Ib3a916d6b4536dc5741223a2801a55d914e187b1
TN: U530-006
2021-11-30 17:41:32 +04:00
Joel Brobecker
010c33e913 encode input and decode output when calling hooks.mailinglist script
This is another preparation patch for the transition to Python 3.x.

The script's input needs to be encoded when called, and its output
needs to be decoded into a string for us to process it.

For input encoding, the same approach as for decoding is taken:
In order to make progress towards Python 3.x support while at
the same time preserving support for Python 2.x, we introduce
a new function "encode_utf8" which only performs the encoding
on Python 3.x. With Python 2.x, the function just returns the string
unmodified.

Change-Id: Ieb47d32c756405cdd0d300254e8cd7c8c3db50b5
TN: U530-006
2021-10-06 11:27:20 -07:00
Joel Brobecker
9c82498e7b Introduce (the concept of) git command output decoding
This commit is preparation work for the transition to Python 3.x,
where the output obtained by running Git commands will become
bytes as opposed to a string. In the vast majority of cases,
we'll want to decode that output into a string. Ideally, we would
want to do this in a way that is both compatible with Python 2.x
and Python 3.x, but we have found that this requires a lot of
work with many changes spread all over the code. So, instead,
what this commit does is introduce the concept of decoding
the output, but with the decoding only occurring when running
under Python 3.x.

That way, we can make progress towards Python 3.x while preserving
the behavior under Python 2.x intact.

Change-Id: I189577798ee96cba1fa55c7356babf102575642f
TN: U530-006
2021-10-06 11:27:20 -07:00