[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: svn commit: r35454 - in trunk: build/generator/util subversion/bindings/swig/python/svn subversion/tests/cmdline subversion/tests/cmdline/svntest tools/backup tools/hook-scripts tools/hook-scripts/mailer

From: Greg Stein <gstein_at_gmail.com>
Date: Sun, 25 Jan 2009 11:54:40 +0100

Strictly speaking, we said Python 2.4 or later for *developers* of
Subversion (e.g. gen-make). I'm not sure we said the same for
end-users (e.g. mailer.py).

That said, I'm fine with that requirement, but I want to make sure we
are all agreed on the impact to our end-users.

Cheers,
-g

On Sun, Jan 25, 2009 at 07:09, Arfrever Frehtes Taifersar Arahesis
<Arfrever.FTA_at_gmail.com> wrote:
> Author: arfrever
> Date: Sat Jan 24 22:09:04 2009
> New Revision: 35454
>
> Log:
> Delete code used only by Python <2.4.
>
> * build/generator/util/executable.py:
> * subversion/bindings/swig/python/svn/fs.py:
> * subversion/tests/cmdline/svntest/main.py:
> * subversion/tests/cmdline/update_tests.py:
> * tools/backup/hot-backup.py.in:
> * tools/hook-scripts/mailer/mailer.py:
> * tools/hook-scripts/verify-po.py: Delete code used only by Python <2.4.
>
> Modified:
> trunk/build/generator/util/executable.py
> trunk/subversion/bindings/swig/python/svn/fs.py
> trunk/subversion/tests/cmdline/svntest/main.py
> trunk/subversion/tests/cmdline/update_tests.py
> trunk/tools/backup/hot-backup.py.in
> trunk/tools/hook-scripts/mailer/mailer.py
> trunk/tools/hook-scripts/verify-po.py
>
> Modified: trunk/build/generator/util/executable.py
> URL: http://svn.collab.net/viewvc/svn/trunk/build/generator/util/executable.py?pathrev=35454&r1=35453&r2=35454
> ==============================================================================
> --- trunk/build/generator/util/executable.py Sat Jan 24 19:46:18 2009 (r35453)
> +++ trunk/build/generator/util/executable.py Sat Jan 24 22:09:04 2009 (r35454)
> @@ -2,7 +2,8 @@
> # executable.py -- Utilities for dealing with external executables
> #
>
> -import os, string
> +import os
> +import subprocess
>
> def exists(file):
> """Is this an executable file?"""
> @@ -23,28 +24,18 @@ def find(file, dirs=None):
>
> def output(cmd, strip=None):
> """Run a command and collect all output"""
> - try:
> - # Python >=2.4
> -
> - # Check that cmd is in PATH (otherwise we'd get a generic OSError later)
> - import distutils.spawn
> - if type(cmd) == type(''):
> - cmdname = cmd
> - elif type(cmd) == type([]):
> - cmdname = cmd[0]
> - if distutils.spawn.find_executable(cmdname) is None:
> - return None
> -
> - # Run it
> - import subprocess
> - (output, empty_stderr) = subprocess.Popen(cmd, stdout=subprocess.PIPE, \
> - stderr=subprocess.STDOUT).communicate()
> - except ImportError:
> - # Python <2.4
> - (stdin, stdout) = os.popen4(cmd)
> - assert(not stdin.close())
> - output = stdout.read()
> - assert(not stdout.close())
> + # Check that cmd is in PATH (otherwise we'd get a generic OSError later)
> + import distutils.spawn
> + if type(cmd) == type(''):
> + cmdname = cmd
> + elif type(cmd) == type([]):
> + cmdname = cmd[0]
> + if distutils.spawn.find_executable(cmdname) is None:
> + return None
> +
> + # Run it
> + (output, empty_stderr) = subprocess.Popen(cmd, stdout=subprocess.PIPE, \
> + stderr=subprocess.STDOUT).communicate()
> if strip:
> return output.strip()
> else:
>
> Modified: trunk/subversion/bindings/swig/python/svn/fs.py
> URL: http://svn.collab.net/viewvc/svn/trunk/subversion/bindings/swig/python/svn/fs.py?pathrev=35454&r1=35453&r2=35454
> ==============================================================================
> --- trunk/subversion/bindings/swig/python/svn/fs.py Sat Jan 24 19:46:18 2009 (r35453)
> +++ trunk/subversion/bindings/swig/python/svn/fs.py Sat Jan 24 22:09:04 2009 (r35454)
> @@ -6,7 +6,7 @@
> #
> ######################################################################
> #
> -# Copyright (c) 2000-2004, 2008 CollabNet. All rights reserved.
> +# Copyright (c) 2000-2004, 2008-2009 CollabNet. All rights reserved.
> #
> # This software is licensed as described in the file COPYING, which
> # you should have received as part of this distribution. The terms
> @@ -24,15 +24,7 @@ del _unprefix_names
>
>
> # Names that are not to be exported
> -import sys as _sys, os as _os, tempfile as _tempfile
> -try:
> - # Python >=2.4
> - import subprocess as _subprocess
> - _platform_with_subprocess = True
> -except ImportError:
> - # Python <2.4
> - _platform_with_subprocess = False
> - import popen2 as _popen2
> +import sys as _sys, os as _os, tempfile as _tempfile, subprocess as _subprocess
> try:
> # Python >=3.0
> import builtins
> @@ -114,25 +106,10 @@ class FileDiff:
> + self.diffoptions \
> + [self.tempfile1, self.tempfile2]
>
> - if _platform_with_subprocess:
> - # Python >=2.4
> -
> - # open the pipe, and return the file object for reading from the child.
> - p = _subprocess.Popen(cmd, stdout=_subprocess.PIPE,
> - close_fds=_sys.platform != "win32")
> - return p.stdout
> - else:
> - # Python <2.4
> -
> - # the windows implementation of popen2 requires a string
> - if _sys.platform == "win32":
> - cmd = _svncore.argv_to_command_string(cmd)
> -
> - # open the pipe, forget the end for writing to the child (we won't),
> - # and then return the file object for reading from the child.
> - fromchild, tochild = _popen2.popen2(cmd)
> - tochild.close()
> - return fromchild
> + # open the pipe, and return the file object for reading from the child.
> + p = _subprocess.Popen(cmd, stdout=_subprocess.PIPE,
> + close_fds=_sys.platform != "win32")
> + return p.stdout
>
> def __del__(self):
> # it seems that sometimes the files are deleted, so just ignore any
>
> Modified: trunk/subversion/tests/cmdline/svntest/main.py
> URL: http://svn.collab.net/viewvc/svn/trunk/subversion/tests/cmdline/svntest/main.py?pathrev=35454&r1=35453&r2=35454
> ==============================================================================
> --- trunk/subversion/tests/cmdline/svntest/main.py Sat Jan 24 19:46:18 2009 (r35453)
> +++ trunk/subversion/tests/cmdline/svntest/main.py Sat Jan 24 22:09:04 2009 (r35454)
> @@ -20,6 +20,7 @@ import os
> import shutil # for rmtree()
> import re
> import stat # for ST_MODE
> +import subprocess
> import copy # for deepcopy()
> import time # for time()
> import traceback # for print_exc()
> @@ -105,22 +106,6 @@ else:
> _exe = ''
> _bat = ''
>
> -try:
> - # Python >=2.4
> - import subprocess
> - platform_with_subprocess = True
> -except ImportError:
> - # Python <2.4
> - platform_with_subprocess = False
> -
> -if not platform_with_subprocess:
> - # Python <2.4
> - try:
> - from popen2 import Popen3
> - platform_with_popen3_class = True
> - except ImportError:
> - platform_with_popen3_class = False
> -
> # The location of our mock svneditor script.
> if windows:
> svneditor_script = os.path.join(sys.path[0], 'svneditor.bat')
> @@ -396,29 +381,12 @@ def _quote_arg(arg):
> arg = arg.replace('$', '\$')
> return '"%s"' % (arg,)
>
> -def open_pipe(command, mode):
> - """Opens a popen3 pipe to COMMAND in MODE.
> -
> - Returns (infile, outfile, errfile, waiter); waiter
> - should be passed to wait_on_pipe."""
> - # Quote only the arguments, neither Popen3() or os.popen3
> - # work if the command itself is quoted.
> - args = command[1:]
> - args = ' '.join([_quote_arg(x) for x in args])
> - command = command[0] + ' ' + args
> - if platform_with_popen3_class:
> - kid = Popen3(command, True)
> - return kid.tochild, kid.fromchild, kid.childerr, (kid, command)
> - else:
> - inf, outf, errf = os.popen3(command, mode)
> - return inf, outf, errf, None
> -
> -def open_pipe2(command, stdin=None, stdout=None, stderr=None):
> +def open_pipe(command, stdin=None, stdout=None, stderr=None):
> """Opens a subprocess.Popen pipe to COMMAND using STDIN,
> - STDOUT, and STDERR. For use with Python > 2.4 only.
> + STDOUT, and STDERR.
>
> Returns (infile, outfile, errfile, waiter); waiter
> - should be passed to wait_on_pipe2."""
> + should be passed to wait_on_pipe."""
> command = [str(x) for x in command]
>
> # On Windows subprocess.Popen() won't accept a Python script as
> @@ -447,40 +415,11 @@ def open_pipe2(command, stdin=None, stdo
> close_fds=not windows)
> return p.stdin, p.stdout, p.stderr, (p, command)
>
> -def wait_on_pipe(waiter, stdout_lines, stderr_lines):
> +def wait_on_pipe(waiter, binary_mode, stdin=None):
> """Waits for KID (opened with open_pipe) to finish, dying
> - if it does. Uses STDOUT_LINES and STDERR_LINES for error message
> - if kid fails. Returns kid's exit code."""
> - if waiter is None:
> - return
> -
> - kid, command = waiter
> - wait_code = kid.wait()
> -
> - if os.WIFSIGNALED(wait_code):
> - exit_signal = os.WTERMSIG(wait_code)
> - if stdout_lines is not None:
> - sys.stdout.write("".join(stdout_lines))
> - if stderr_lines is not None:
> - sys.stderr.write("".join(stderr_lines))
> - if verbose_mode:
> - # show the whole path to make it easier to start a debugger
> - sys.stderr.write("CMD: %s terminated by signal %d\n"
> - % (' '.join(command), exit_signal))
> - raise SVNProcessTerminatedBySignal
> - else:
> - exit_code = os.WEXITSTATUS(wait_code)
> - if exit_code and verbose_mode:
> - sys.stderr.write("CMD: %s exited with %d\n"
> - % (' '.join(command), exit_code))
> - return exit_code
> -
> -def wait_on_pipe2(waiter, binary_mode, stdin=None):
> - """Waits for KID (opened with open_pipe2) to finish, dying
> if it does. If kid fails create an error message containing
> any stdout and stderr from the kid. Returns kid's exit code,
> - stdout and stderr (the latter two as lists).
> - For use with Python > 2.4 only."""
> + stdout and stderr (the latter two as lists)."""
> if waiter is None:
> return
>
> @@ -522,28 +461,14 @@ def spawn_process(command, binary_mode=0
> ' '.join([_quote_arg(x) for x in varargs])))
> sys.stdout.flush()
>
> - if binary_mode:
> - mode = 'b'
> - else:
> - mode = 't'
> -
> - if platform_with_subprocess:
> - infile, outfile, errfile, kid = open_pipe2([command] + list(varargs))
> - else:
> - infile, outfile, errfile, kid = open_pipe([command] + list(varargs), mode)
> + infile, outfile, errfile, kid = open_pipe([command] + list(varargs))
>
> if stdin_lines:
> for x in stdin_lines:
> infile.write(x)
>
> - if platform_with_subprocess:
> - stdout_lines, stderr_lines, exit_code = wait_on_pipe2(kid, binary_mode)
> - infile.close()
> - else:
> - infile.close()
> - stdout_lines = outfile.readlines()
> - stderr_lines = errfile.readlines()
> - exit_code = wait_on_pipe(kid, stdout_lines, stderr_lines)
> + stdout_lines, stderr_lines, exit_code = wait_on_pipe(kid, binary_mode)
> + infile.close()
>
> outfile.close()
> errfile.close()
> @@ -840,54 +765,25 @@ def copy_repos(src_path, dst_path, head_
> sys.stdout.flush()
> start = time.time()
>
> - if platform_with_subprocess:
> - dump_in, dump_out, dump_err, dump_kid = open_pipe2(
> - [svnadmin_binary] + dump_args)
> - load_in, load_out, load_err, load_kid = open_pipe2(
> - [svnadmin_binary] + load_args,
> - stdin=dump_out) # Attached to dump_kid
> + dump_in, dump_out, dump_err, dump_kid = open_pipe(
> + [svnadmin_binary] + dump_args)
> + load_in, load_out, load_err, load_kid = open_pipe(
> + [svnadmin_binary] + load_args,
> + stdin=dump_out) # Attached to dump_kid
>
> - stop = time.time()
> - if verbose_mode:
> - print('<TIME = %.6f>' % (stop - start))
> -
> - load_stdout, load_stderr, load_exit_code = wait_on_pipe2(load_kid, 'b')
> - dump_stdout, dump_stderr, dump_exit_code = wait_on_pipe2(dump_kid, 'b')
> -
> - dump_in.close()
> - dump_out.close()
> - dump_err.close()
> - #load_in is dump_out so it's already closed.
> - load_out.close()
> - load_err.close()
> - else:
> - # Python < 2.4
> - dump_in, dump_out, dump_err, dump_kid = \
> - open_pipe([svnadmin_binary] + dump_args, 'b')
> - dump_in.close()
> - load_in, load_out, load_err, load_kid = \
> - open_pipe([svnadmin_binary] + load_args, 'b')
> - stop = time.time()
> - if verbose_mode:
> - print('<TIME = %.6f>' % (stop - start))
> + stop = time.time()
> + if verbose_mode:
> + print('<TIME = %.6f>' % (stop - start))
>
> - while 1:
> - data = dump_out.read(1024*1024) # Arbitrary buffer size
> - if data == "":
> - break
> - load_in.write(data)
> - load_in.close() # Tell load we are done
> + load_stdout, load_stderr, load_exit_code = wait_on_pipe(load_kid, True)
> + dump_stdout, dump_stderr, dump_exit_code = wait_on_pipe(dump_kid, True)
>
> - dump_stderr = dump_err.readlines()
> - load_stdout = load_out.readlines()
> - dump_out.close()
> - dump_err.close()
> - load_out.close()
> - load_err.close()
> -
> - # Wait on the pipes; ignore return code.
> - wait_on_pipe(dump_kid, None, dump_stderr)
> - wait_on_pipe(load_kid, load_stdout, None)
> + dump_in.close()
> + dump_out.close()
> + dump_err.close()
> + #load_in is dump_out so it's already closed.
> + load_out.close()
> + load_err.close()
>
> dump_re = re.compile(r'^\* Dumped revision (\d+)\.\r?$')
> expect_revision = 0
>
> Modified: trunk/subversion/tests/cmdline/update_tests.py
> URL: http://svn.collab.net/viewvc/svn/trunk/subversion/tests/cmdline/update_tests.py?pathrev=35454&r1=35453&r2=35454
> ==============================================================================
> --- trunk/subversion/tests/cmdline/update_tests.py Sat Jan 24 19:46:18 2009 (r35453)
> +++ trunk/subversion/tests/cmdline/update_tests.py Sat Jan 24 22:09:04 2009 (r35454)
> @@ -6,7 +6,7 @@
> # See http://subversion.tigris.org for more information.
> #
> # ====================================================================
> -# Copyright (c) 2000-2008 CollabNet. All rights reserved.
> +# Copyright (c) 2000-2009 CollabNet. All rights reserved.
> #
> # This software is licensed as described in the file COPYING, which
> # you should have received as part of this distribution. The terms
> @@ -17,7 +17,7 @@
> ######################################################################
>
> # General modules
> -import sys, re, os
> +import sys, re, os, subprocess
>
> # Our testing module
> import svntest
> @@ -2138,13 +2138,7 @@ def update_wc_on_windows_drive(sbox):
> if drive is None:
> raise svntest.Skip
>
> - try:
> - # Python >=2.4
> - import subprocess
> - subprocess.call(['subst', drive +':', sbox.wc_dir])
> - except ImportError:
> - # Python <2.4
> - os.popen3('subst ' + drive +': ' + sbox.wc_dir, 't')
> + subprocess.call(['subst', drive +':', sbox.wc_dir])
> wc_dir = drive + ':/'
> was_cwd = os.getcwd()
>
> @@ -2243,13 +2237,7 @@ def update_wc_on_windows_drive(sbox):
> finally:
> os.chdir(was_cwd)
> # cleanup the virtual drive
> - try:
> - # Python >=2.4
> - import subprocess
> - subprocess.call(['subst', '/D', drive +':'])
> - except ImportError:
> - # Python <2.4
> - os.popen3('subst /D ' + drive +': ', 't')
> + subprocess.call(['subst', '/D', drive +':'])
>
> # Issue #2618: "'Checksum mismatch' error when receiving
> # update for replaced-with-history file".
>
> Modified: trunk/tools/backup/hot-backup.py.in
> URL: http://svn.collab.net/viewvc/svn/trunk/tools/backup/hot-backup.py.in?pathrev=35454&r1=35453&r2=35454
> ==============================================================================
> --- trunk/tools/backup/hot-backup.py.in Sat Jan 24 19:46:18 2009 (r35453)
> +++ trunk/tools/backup/hot-backup.py.in Sat Jan 24 22:09:04 2009 (r35454)
> @@ -10,7 +10,7 @@
> # See http://subversion.tigris.org for more information.
> #
> # ====================================================================
> -# Copyright (c) 2000-2008 CollabNet. All rights reserved.
> +# Copyright (c) 2000-2009 CollabNet. All rights reserved.
> #
> # This software is licensed as described in the file COPYING, which
> # you should have received as part of this distribution. The terms
> @@ -30,19 +30,7 @@
>
> ######################################################################
>
> -import sys, os, getopt, stat, re, time, shutil
> -
> -# Try to import the subprocess module. It works better then os.popen3
> -# and os.spawnl on Windows when spaces appear in any of the svnadmin,
> -# svnlook or repository paths. os.popen3 and os.spawnl are still used
> -# to support Python 2.3 and older which do not provide the subprocess
> -# module. have_subprocess is set to 1 or 0 to support older Python
> -# versions that do not have True and False.
> -try:
> - import subprocess
> - have_subprocess = 1
> -except ImportError:
> - have_subprocess = 0
> +import sys, os, getopt, stat, re, time, shutil, subprocess
>
> ######################################################################
> # Global Settings
> @@ -200,14 +188,11 @@ def get_youngest_revision():
> """Examine the repository REPO_DIR using the svnlook binary
> specified by SVNLOOK, and return the youngest revision."""
>
> - if have_subprocess:
> - p = subprocess.Popen([svnlook, 'youngest', repo_dir],
> - stdin=subprocess.PIPE,
> - stdout=subprocess.PIPE,
> - stderr=subprocess.PIPE)
> - infile, outfile, errfile = p.stdin, p.stdout, p.stderr
> - else:
> - infile, outfile, errfile = os.popen3(svnlook + " youngest " + repo_dir)
> + p = subprocess.Popen([svnlook, 'youngest', repo_dir],
> + stdin=subprocess.PIPE,
> + stdout=subprocess.PIPE,
> + stderr=subprocess.PIPE)
> + infile, outfile, errfile = p.stdin, p.stdout, p.stderr
>
> stdout_lines = outfile.readlines()
> stderr_lines = errfile.readlines()
> @@ -267,12 +252,8 @@ if young_list:
> ### copied last.
>
> print("Backing up repository to '" + backup_subdir + "'...")
> -if have_subprocess:
> - err_code = subprocess.call([svnadmin, "hotcopy", repo_dir,
> - backup_subdir, "--clean-logs"])
> -else:
> - err_code = os.spawnl(os.P_WAIT, svnadmin, "svnadmin", "hotcopy", repo_dir,
> - backup_subdir, "--clean-logs")
> +err_code = subprocess.call([svnadmin, "hotcopy", repo_dir,
> + backup_subdir, "--clean-logs"])
> if err_code != 0:
> sys.stderr.write("Unable to backup the repository.\n")
> sys.stderr.flush()
>
> Modified: trunk/tools/hook-scripts/mailer/mailer.py
> URL: http://svn.collab.net/viewvc/svn/trunk/tools/hook-scripts/mailer/mailer.py?pathrev=35454&r1=35453&r2=35454
> ==============================================================================
> --- trunk/tools/hook-scripts/mailer/mailer.py Sat Jan 24 19:46:18 2009 (r35453)
> +++ trunk/tools/hook-scripts/mailer/mailer.py Sat Jan 24 22:09:04 2009 (r35454)
> @@ -36,14 +36,7 @@ except ImportError:
> import ConfigParser as configparser
> from urllib import quote as urllib_parse_quote
> import time
> -try:
> - # Python >=2.4
> - import subprocess
> - platform_with_subprocess = True
> -except ImportError:
> - # Python <2.4
> - import popen2
> - platform_with_subprocess = False
> +import subprocess
> if sys.version_info[0] >= 3:
> # Python >=3.0
> from io import StringIO
> @@ -112,42 +105,6 @@ def main(pool, cmd, config_fname, repos_
> messenger.generate()
>
>
> -if not platform_with_subprocess:
> - # Minimal, incomplete, versions of popen2.Popen[34] for those platforms
> - # for which popen2 does not provide them.
> - try:
> - Popen3 = popen2.Popen3
> - Popen4 = popen2.Popen4
> - except AttributeError:
> - class Popen3:
> - def __init__(self, cmd, capturestderr = False):
> - if type(cmd) != types.StringType:
> - cmd = svn.core.argv_to_command_string(cmd)
> - if capturestderr:
> - self.fromchild, self.tochild, self.childerr \
> - = popen2.popen3(cmd, mode='b')
> - else:
> - self.fromchild, self.tochild = popen2.popen2(cmd, mode='b')
> - self.childerr = None
> -
> - def wait(self):
> - rv = self.fromchild.close()
> - rv = self.tochild.close() or rv
> - if self.childerr is not None:
> - rv = self.childerr.close() or rv
> - return rv
> -
> - class Popen4:
> - def __init__(self, cmd):
> - if type(cmd) != types.StringType:
> - cmd = svn.core.argv_to_command_string(cmd)
> - self.fromchild, self.tochild = popen2.popen4(cmd, mode='b')
> -
> - def wait(self):
> - rv = self.fromchild.close()
> - rv = self.tochild.close() or rv
> - return rv
> -
> def remove_leading_slashes(path):
> while path and path[0] == '/':
> path = path[1:]
> @@ -208,23 +165,14 @@ class OutputBase:
> """Override this method, if the default implementation is not sufficient.
> Execute CMD, writing the stdout produced to the output representation."""
> # By default we choose to incorporate child stderr into the output
> - if platform_with_subprocess:
> - pipe_ob = subprocess.Popen(cmd, stdout=subprocess.PIPE,
> - stderr=subprocess.STDOUT,
> - close_fds=sys.platform != "win32")
> - else:
> - pipe_ob = Popen4(cmd)
> + pipe_ob = subprocess.Popen(cmd, stdout=subprocess.PIPE,
> + stderr=subprocess.STDOUT,
> + close_fds=sys.platform != "win32")
>
> - if platform_with_subprocess:
> - buf = pipe_ob.stdout.read(self._CHUNKSIZE)
> - else:
> - buf = pipe_ob.fromchild.read(self._CHUNKSIZE)
> + buf = pipe_ob.stdout.read(self._CHUNKSIZE)
> while buf:
> self.write(buf)
> - if platform_with_subprocess:
> - buf = pipe_ob.stdout.read(self._CHUNKSIZE)
> - else:
> - buf = pipe_ob.fromchild.read(self._CHUNKSIZE)
> + buf = pipe_ob.stdout.read(self._CHUNKSIZE)
>
> # wait on the child so we don't end up with a billion zombies
> pipe_ob.wait()
> @@ -332,26 +280,16 @@ class PipeOutput(MailedOutput):
> cmd = self.cmd + [ '-f', self.from_addr ] + self.to_addrs
>
> # construct the pipe for talking to the mailer
> - if platform_with_subprocess:
> - self.pipe = subprocess.Popen(cmd, stdin=subprocess.PIPE,
> - close_fds=sys.platform != "win32")
> - self.write = self.pipe.stdin.write
> - else:
> - self.pipe = Popen3(cmd)
> - self.write = self.pipe.tochild.write
> -
> - # we don't need the read-from-mailer descriptor, so close it
> - self.pipe.fromchild.close()
> + self.pipe = subprocess.Popen(cmd, stdin=subprocess.PIPE,
> + close_fds=sys.platform != "win32")
> + self.write = self.pipe.stdin.write
>
> # start writing out the mail message
> self.write(self.mail_headers(group, params))
>
> def finish(self):
> # signal that we're done sending content
> - if platform_with_subprocess:
> - self.pipe.stdin.close()
> - else:
> - self.pipe.tochild.close()
> + self.pipe.stdin.close()
>
> # wait to avoid zombies
> self.pipe.wait()
> @@ -955,12 +893,9 @@ class DiffContent:
> self.seen_change = False
>
> # By default we choose to incorporate child stderr into the output
> - if platform_with_subprocess:
> - self.pipe = subprocess.Popen(cmd, stdout=subprocess.PIPE,
> - stderr=subprocess.STDOUT,
> - close_fds=sys.platform != "win32")
> - else:
> - self.pipe = Popen4(cmd)
> + self.pipe = subprocess.Popen(cmd, stdout=subprocess.PIPE,
> + stderr=subprocess.STDOUT,
> + close_fds=sys.platform != "win32")
>
> def __nonzero__(self):
> # we always have some items
> @@ -970,10 +905,7 @@ class DiffContent:
> if self.pipe is None:
> raise IndexError
>
> - if platform_with_subprocess:
> - line = self.pipe.stdout.readline()
> - else:
> - line = self.pipe.fromchild.readline()
> + line = self.pipe.stdout.readline()
> if not line:
> # wait on the child so we don't end up with a billion zombies
> self.pipe.wait()
>
> Modified: trunk/tools/hook-scripts/verify-po.py
> URL: http://svn.collab.net/viewvc/svn/trunk/tools/hook-scripts/verify-po.py?pathrev=35454&r1=35453&r2=35454
> ==============================================================================
> --- trunk/tools/hook-scripts/verify-po.py Sat Jan 24 19:46:18 2009 (r35453)
> +++ trunk/tools/hook-scripts/verify-po.py Sat Jan 24 22:09:04 2009 (r35454)
> @@ -6,14 +6,7 @@ committed to the repository are encoded
> import codecs
> import string
> import sys
> -try:
> - # Python >=2.4
> - import subprocess
> - platform_with_subprocess = True
> -except ImportError:
> - # Python <2.4
> - import popen2
> - platform_with_subprocess = False
> +import subprocess
> from svn import core, fs, delta, repos
>
> # Set to the path of the 'msgfmt' executable to use msgfmt to check
> @@ -24,32 +17,22 @@ USE_MSGFMT = None
> if USE_MSGFMT is not None:
> class MsgFmtChecker:
> def __init__(self):
> - if platform_with_subprocess:
> - self.pipe = subprocess.Popen([USE_MSGFMT, "-c", "-o", "/dev/null", "-"],
> - stdin=subprocess.PIPE,
> - close_fds=sys.platform != "win32")
> - else:
> - self.pipe = popen2.Popen3("%s -c -o /dev/null -" % USE_MSGFMT)
> - self.pipe.fromchild.close()
> + self.pipe = subprocess.Popen([USE_MSGFMT, "-c", "-o", "/dev/null", "-"],
> + stdin=subprocess.PIPE,
> + close_fds=sys.platform != "win32")
> self.io_error = 0
>
> def write(self, data):
> if self.io_error:
> return
> try:
> - if platform_with_subprocess:
> - self.pipe.stdin.write(data)
> - else:
> - self.pipe.tochild.write(data)
> + self.pipe.stdin.write(data)
> except IOError:
> self.io_error = 1
>
> def close(self):
> try:
> - if platform_with_subprocess:
> - self.pipe.stdin.close()
> - else:
> - self.pipe.tochild.close()
> + self.pipe.stdin.close()
> except IOError:
> self.io_error = 1
> return self.pipe.wait() == 0 and not self.io_error
>
> ------------------------------------------------------
> http://subversion.tigris.org/ds/viewMessage.do?dsForumId=495&dsMessageId=1048761
>

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=1049418
Received on 2009-01-25 11:55:01 CET

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.