Daniel Shahaf wrote:
> (Patch manager hat on. I was about to file this, but then...)
Ups, I' very sorry. Somehow this slipped through :(
You should not have any problems with the patch below. I only needed to
add 'stdout=subprocess.PIPE' to subprocess.Popen().
Thanks again, Niels
> Niels de Vos wrote on Mon, 28 Jul 2008 at 10:39 +0200:
>> Okay, here it is. This patch replaces the non-Windows popen2 usage with
>> the platform independent subprocess module. As discussed, this requires
>> at least Pyhon-2.4 as earlier versions do not contain the subprocess
>> module.
Index: svn2feed.py
===================================================================
--- svn2feed.py (revision 32448)
+++ svn2feed.py (working copy)
@@ -78,7 +78,7 @@
import getopt
import os
-import popen2
+import subprocess
import cPickle as pickle
import datetime
import time
@@ -127,18 +127,14 @@
revision = str(revision)
cmd = [self.svnlook_cmd, 'info', '-r', revision, self.repos_path]
- child_out, child_in, child_err = popen2.popen3(cmd)
- info_lines = child_out.readlines()
- child_out.close()
- child_in.close()
- child_err.close()
+ proc = subprocess.Popen(cmd, stdout=subprocess.PIPE)
+ proc.wait()
+ info_lines = proc.stdout.readlines()
cmd = [self.svnlook_cmd, 'changed', '-r', revision, self.repos_path]
- child_out, child_in, child_err = popen2.popen3(cmd)
- changed_data = child_out.read()
- child_out.close()
- child_in.close()
- child_err.close()
+ proc = subprocess.Popen(cmd, stdout=subprocess.PIPE)
+ proc.wait()
+ changed_data = proc.stdout.readlines()
desc = ("\nRevision: %s\nLog: %sModified: \n%s"
% (revision, info_lines[3], changed_data))
@@ -411,13 +407,10 @@
svnlook_cmd = 'svnlook'
if svn_path is not None:
svnlook_cmd = os.path.join(svn_path, 'svnlook')
- child_out, child_in, child_err = popen2.popen3([svnlook_cmd,
- 'youngest',
- repos_path])
- cmd_out = child_out.readlines()
- child_out.close()
- child_in.close()
- child_err.close()
+ cmd = [svnlook_cmd, 'youngest', repos_path]
+ proc = subprocess.Popen(cmd, stdout=subprocess.PIPE)
+ proc.wait()
+ cmd_out = proc.stdout.readlines()
try:
revisions = [int(cmd_out[0])]
except IndexError, msg:
Received on 2008-08-13 01:47:53 CEST