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
closes #1173 - backporting python2.7 subprocess's check_output to be abl... #1174
Conversation
…able to support python 2.6
if hasattr(subprocess, 'check_output'): | ||
check_output = subprocess.check_output | ||
else: | ||
check_output = _check_output |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer to see this added to cbook.py
, the current location for utility functions. cbook is large and disorganized, but I'd rather do that reorganization properly than start adding things in unexpected places right now.
Other than my comment about where check_output should go, I think this is a great solution. Any you're right -- there are some other places that use subprocess that probably should start using this, but that doesn't need to be done for the 1.2 release. (They don't now because the code probably predates Python 2.7). |
I was not aware cbooks was the default place to put the utility function: I've moved it there and the tests on this module run fine on python2.6 ! |
Looks good to me. Will merge in 24 hours. |
closes #1173 - backporting python2.7 subprocess's check_output to be abl...
...e to support python 2.6
I've added a new module called utils, in which I copy pasted the python2.7 subprocess check_output method. If the subprocess module has it (python 2.7 and above) it will use the stdlib version. Else, it will used the copy pasted 2.7 version.
I then modified the pgf's backend to use this method instead of the one provided in subprocess.
this patch closes #1173