Files
Joel Brobecker 268ed9d3a2 java.py: Avoid use of os.write (Python 3.x compatibility)
This os.write function is a low-level function whose API changed
between Python 2.7 and Python 3.x. With Python 2.7, it takes
a string as a parameter, whereas with Python 3.x, it takes
a bytestring.

This commit re-implements the function so as to make it compatible
with both Python 2 and Python 3.7, by avoiding the call to os.write
entirely. Instead, we convert the the file descriptor that mkstemp
returned, and use the regular methods of the File class from there.
This allows us to use a "with" clause, combined with contextlib.closing
to automate the closing of that file once we're done writing to it.

Change-Id: Ie3a46d1c2672e801c56488f452dfcece33c0ea77
TN: T605-002
2020-07-28 18:07:47 -07:00
..
2020-07-08 17:10:38 -07:00