New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port util/process_handler.py and util/tarutil.py #6082

Merged
merged 3 commits into from Jul 9, 2018

Conversation

Projects
None yet
2 participants
@Eric-Arellano
Copy link
Contributor

Eric-Arellano commented Jul 9, 2018

Followup from #6073 port of util. These required manual changes. util is all ported after this.

@@ -106,7 +106,7 @@ def join_and_get_output():


def _tee(infile, outfile, return_function):
accumulator = StringIO.StringIO()
accumulator = io.BytesIO()

This comment has been minimized.

@Eric-Arellano

Eric-Arellano Jul 9, 2018

Contributor

StringIO.StringIO() allows for both bytes and unicode. The library was removed in Python3.

Instead, we're using io.BytesIO(), which allows for only bytes. This is what we want - io.StringIO() fails the tests whereas this passes.

class TarFile(tarfile.TarFile):
def next(self):
"""A copy and modification of the next() method in tarfile module.
@implements_iterator

This comment has been minimized.

@Eric-Arellano

Eric-Arellano Jul 9, 2018

Contributor

Py2 expects the function next() whereas Py3 expects __next__(). This decorator handles that discrepancy.



if six.PY2:

This comment has been minimized.

@Eric-Arellano

Eric-Arellano Jul 9, 2018

Contributor

Now creating the same class for both Py2 and Py3. I'm not sure why the original author only patched the Py2 behavior - Py3 still needs the patch (see new line 64).

@stuhood

stuhood approved these changes Jul 9, 2018

Copy link
Member

stuhood left a comment

Thanks!

@stuhood stuhood merged commit a81f5cd into pantsbuild:master Jul 9, 2018

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@Eric-Arellano Eric-Arellano deleted the Eric-Arellano:port-process-handler branch Jul 9, 2018

@Eric-Arellano

This comment has been minimized.

Copy link
Contributor

Eric-Arellano commented Jul 9, 2018

Linking to #6062 (so that it can be source of truth for changes).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment