summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2008-10-07 00:40:11 (GMT)
committerSteven Knight <knight@baldmt.com>2008-10-07 00:40:11 (GMT)
commitd91fcf97d58b71e4ec57b405be51dd1f923eff79 (patch)
treebc7ebfee28b3e34b86c38837c6a951c6121f8a0a
parenta60a83619bc1524c2014fc897fdfd64c1ab3684d (diff)
downloadSCons-d91fcf97d58b71e4ec57b405be51dd1f923eff79.zip
SCons-d91fcf97d58b71e4ec57b405be51dd1f923eff79.tar.gz
SCons-d91fcf97d58b71e4ec57b405be51dd1f923eff79.tar.bz2
Initial Python 2.6 portability in SCons code itself, using subprocess
in place of popen2, and calling hashlib.md5() instead of the md5 module.
-rw-r--r--src/engine/SCons/Platform/posix.py8
-rw-r--r--src/engine/SCons/Tool/msvs.py8
-rw-r--r--src/engine/SCons/Tool/rpm.py13
3 files changed, 17 insertions, 12 deletions
diff --git a/src/engine/SCons/Platform/posix.py b/src/engine/SCons/Platform/posix.py
index bc8d67c..12a6f60 100644
--- a/src/engine/SCons/Platform/posix.py
+++ b/src/engine/SCons/Platform/posix.py
@@ -35,8 +35,8 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import errno
import os
import os.path
-import popen2
import string
+import subprocess
import sys
import select
@@ -131,8 +131,10 @@ def process_cmd_output(cmd_stdout, cmd_stderr, stdout, stderr):
raise
def exec_popen3(l, env, stdout, stderr):
- proc = popen2.Popen3(string.join(l), 1)
- process_cmd_output(proc.fromchild, proc.childerr, stdout, stderr)
+ proc = subprocess.Popen(string.join(l),
+ stdout=stdout,
+ stderr=stderr,
+ shell=True)
stat = proc.wait()
if stat & 0xff:
return stat | 0x80
diff --git a/src/engine/SCons/Tool/msvs.py b/src/engine/SCons/Tool/msvs.py
index 33efad9..5aedf9c 100644
--- a/src/engine/SCons/Tool/msvs.py
+++ b/src/engine/SCons/Tool/msvs.py
@@ -34,7 +34,7 @@ selection method.
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import base64
-import md5
+import hashlib
import os.path
import pickle
import re
@@ -79,9 +79,11 @@ def _generateGUID(slnfile, name):
based on the MD5 signatures of the sln filename plus the name of
the project. It basically just needs to be unique, and not
change with each invocation."""
+ m = hashlib.md5()
+ m.update(str(slnfile) + str(name))
# TODO(1.5)
- #solution = _hexdigest(md5.new(str(slnfile)+str(name)).digest()).upper()
- solution = string.upper(_hexdigest(md5.new(str(slnfile)+str(name)).digest()))
+ #solution = m.hexdigest().upper()
+ solution = string.upper(_hexdigest(m.digest()))
# convert most of the signature to GUID form (discard the rest)
solution = "{" + solution[:8] + "-" + solution[8:12] + "-" + solution[12:16] + "-" + solution[16:20] + "-" + solution[20:32] + "}"
return solution
diff --git a/src/engine/SCons/Tool/rpm.py b/src/engine/SCons/Tool/rpm.py
index 47759ea..adb9de1 100644
--- a/src/engine/SCons/Tool/rpm.py
+++ b/src/engine/SCons/Tool/rpm.py
@@ -38,7 +38,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import os
import re
import shutil
-import popen2
+import subprocess
import SCons.Builder
import SCons.Node.FS
@@ -67,11 +67,12 @@ def build_rpm(target, source, env):
env.Prepend( RPMFLAGS = '--define \'_topdir %s\'' % tmpdir )
# now call rpmbuild to create the rpm package.
- handle = popen2.Popen3( get_cmd(source, env), capturestderr=1 )
- output = handle.fromchild.read()
- #output += handle.childerr.read()
- output = output + handle.childerr.read()
- status = handle.wait()
+ handle = subprocess.Popen(get_cmd(source, env),
+ stdout=subprocess.PIPE,
+ stderr=subprocess.STDOUT,
+ shell=True)
+ output = handle.stdout.read()
+ status = handle.wait()
if status:
raise SCons.Errors.BuildError( node=target[0],