This prevents fedpkg patch suffix aborting with the error message "Could not execute patch: write() argument must be str, not bytes".
fedpkg patch suffix
Signed-off-by: FeRD (Frank Dana) ferdnyc@gmail.com
(Specifically, the error occurs when patch reaches these lines:
patch
# Write out the patch open(os.path.join(self.path, outfile), 'w').write(output)
...and output is a bytes object.)
output
bytes
Note: If Python 3.6 is still meant to be supported (I notice PR #730 from only a few months ago), then this PR will break compatibility because subprocess.Popen() didn't take a text= argument until Python 3.7.
subprocess.Popen()
text=
Of course, Python 3.6 has been past end-of-life since December 2021...
The reason the CI doesn't fail in tox -e py36, despite my incompatible change, is that tests/commands/test_patch.py... never actually calls cmd.patch(). It only tests cmd._byte_offset_to_line_number().
tox -e py36
tests/commands/test_patch.py
cmd.patch()
cmd._byte_offset_to_line_number()
(This also explains why the tests have been passing under all versions, despite subprocess.Popen() not being called correctly in patch().)
patch()
rebased onto 266ce739a075c6cee1a0221fd8faf0fc823daf37
You're right the Python 3.6 in Fedora has been the history for some time already. But rpkg is used internally for some Red Hat product, which is still supported in older releases. Therefore, I am trying to keep this backwards compatibility.
universal_newlines=True is still there for compatibility - I will replace text=True with it.
universal_newlines=True
text=True
Commit f828c71a fixes this pull-request
Pull-Request has been merged by onosek
This prevents
fedpkg patch suffixaborting with the error message"Could not execute patch: write() argument must be str, not bytes".
Signed-off-by: FeRD (Frank Dana) ferdnyc@gmail.com