2.4isms for bzr

Aaron Bentley aaron.bentley at utoronto.ca
Tue Jul 26 16:52:08 BST 2005


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Here are a couple of patches for the Python 2.4 transition
1. Always invoke python-2.4, never 2.3 (more complete than Wouter's
version).
2. patch.py now uses subprocess instead of popen

The rest of the code looks pretty clean, except for the unused functions
bzrlib.osutils.extern_command() and bzrlib.osutils.uuid(), and a few
calls to spawn*.

I'm kinda shocked that Popen.communicate() is a one-time function.  I
thought you'd iterate through it like so:

output = []
error = []
for line in input:
    out_chunk, err_chunk = process.communicate(input)
    output.append(out_chunk)
    error.append(err_chunk)

Is there no efficient way to run a command that accepts and produces
large amounts of data without running the risk of deadlocks?  Hmm.  You
could get away with blocking writes if you split your input into
buffer-sized chunks, but you'd at least need non-blocking reads.

Aaron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFC5lwo0F+nu1YWqI0RAhjIAJ97sJ7+Tw4CFngV2e3o672ExFs8FACfX0LT
cwxCc21U+QbqcRS2LpaCpn0=
=cXEJ
-----END PGP SIGNATURE-----
-------------- next part --------------
A non-text attachment was scrubbed...
Name: subproc-patch.patch
Type: text/x-patch
Size: 2723 bytes
Desc: not available
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20050726/28acccf3/attachment.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: reinvoke.patch
Type: text/x-patch
Size: 1070 bytes
Desc: not available
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20050726/28acccf3/attachment-0001.bin 


More information about the bazaar mailing list