summaryrefslogtreecommitdiffstats
path: root/src/engine/SCons/compat/_scons_subprocess.py
diff options
context:
space:
mode:
authorGreg Noel <GregNoel@tigris.org>2010-03-29 14:21:04 (GMT)
committerGreg Noel <GregNoel@tigris.org>2010-03-29 14:21:04 (GMT)
commit238a7bdb01614c5d6b81fdebadd069bc40a61d23 (patch)
treede2e680e944eb3c51fe1ba93714beba4605b18f4 /src/engine/SCons/compat/_scons_subprocess.py
parent7adebb06bb6055345cc584377159d8052ea39e1b (diff)
downloadSCons-238a7bdb01614c5d6b81fdebadd069bc40a61d23.zip
SCons-238a7bdb01614c5d6b81fdebadd069bc40a61d23.tar.gz
SCons-238a7bdb01614c5d6b81fdebadd069bc40a61d23.tar.bz2
http://scons.tigris.org/issues/show_bug.cgi?id=2345
The 'buffer' fixer simply replaces 'buffer( ... )' with 'memoryview( ... )', which is incorrect for our cases, so these changes had to be done by hand and a forward-compatibility class added. The 'xrange' fixer was applied. Manual changes were minimal: a few case in test strings and one use of 'range' as an identifer in the same scope as where 'xrange' was converted to 'range'. The "sets15" compat function, which provided backward compatibility for Python versions prior to 2.2, was removed as no longer needed.
Diffstat (limited to 'src/engine/SCons/compat/_scons_subprocess.py')
-rw-r--r--src/engine/SCons/compat/_scons_subprocess.py14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/engine/SCons/compat/_scons_subprocess.py b/src/engine/SCons/compat/_scons_subprocess.py
index 67eafca..bdcae63 100644
--- a/src/engine/SCons/compat/_scons_subprocess.py
+++ b/src/engine/SCons/compat/_scons_subprocess.py
@@ -458,13 +458,10 @@ try:
except AttributeError:
try:
types.StringTypes = (str, unicode)
- except AttributeError:
+ except NameError:
types.StringTypes = (str,)
- def is_string(obj):
- return type(obj) in types.StringTypes
-else:
- def is_string(obj):
- return isinstance(obj, types.StringTypes)
+def is_string(obj):
+ return isinstance(obj, types.StringTypes)
_active = []
@@ -1002,7 +999,7 @@ class Popen(object):
def _close_fds(self, but):
- for i in xrange(3, MAXFD):
+ for i in range(3, MAXFD):
if i == but:
continue
try:
@@ -1186,7 +1183,8 @@ class Popen(object):
# When select has indicated that the file is writable,
# we can write up to PIPE_BUF bytes without risk
# blocking. POSIX defines PIPE_BUF >= 512
- bytes_written = os.write(self.stdin.fileno(), buffer(input, input_offset, 512))
+ m = memoryview(input)[input_offset:input_offset+512]
+ bytes_written = os.write(self.stdin.fileno(), m)
input_offset = input_offset + bytes_written
if input_offset >= len(input):
self.stdin.close()