Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Unified Diff: third_party/yasm/patched-yasm/tools/python-yasm/pyxelator/work_unit.py

Issue 6170009: Update our yasm copy to yasm 1.1.0 (Part 1: yasm side)... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/
Patch Set: Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/yasm/patched-yasm/tools/python-yasm/pyxelator/work_unit.py
===================================================================
--- third_party/yasm/patched-yasm/tools/python-yasm/pyxelator/work_unit.py (revision 71129)
+++ third_party/yasm/patched-yasm/tools/python-yasm/pyxelator/work_unit.py (working copy)
@@ -16,6 +16,18 @@
import cparse
import ir
+def callcmd(cmd):
+ try:
+ from subprocess import call
+ try:
+ retcode = call(cmd, shell=True)
+ assert retcode == 0, "command failed: %s"%cmd
+ except OSError, e:
+ assert False, "command failed: %s"%e
+ except ImportError:
+ status = os.system( cmd )
+ assert status == 0, "command failed: %s"%cmd
+
class WorkUnit(object):
def __init__(self, files, modname, filename,
std=False, strip=False, mark_cb=None,
@@ -62,13 +74,11 @@
ifile.close()
cmd = '%s %s %s > %s'%(self.CPP,name+'.h',self.CPPFLAGS,name+'.E')
sys.stderr.write( "# %s\n" % cmd )
- status = os.system( cmd )
- assert status == 0, "command failed: %s"%cmd
+ callcmd( cmd )
assert open(name+'.E').read().count('\n') > 10, "failed to run preprocessor"
cmd = '%s -dM %s %s > %s'%(self.CPP,name+'.h',self.CPPFLAGS,name+'.dM')
sys.stderr.write( "# %s\n" % cmd )
- status = os.system( cmd )
- assert status == 0, "command failed: %s"%cmd
+ callcmd( cmd )
assert open(name+'.dM').read().count('\n') > 10, "failed to run preprocessor with -dM"
return name
@@ -157,7 +167,12 @@
accept = [ ' %s '%c for c in 'TVWBCDGRS' ]
#f = open('syms.out','w')
for libname in libnames:
- fin, fout = os.popen2( 'nm %s' % libname )
+ try:
+ from subprocess import Popen, PIPE
+ p = Popen(['nm', libname], bufsize=1, stdout=PIPE)
+ fout = p.stdout
+ except ImportError:
+ fin, fout = os.popen2( 'nm %s' % libname )
for line in fout.readlines():
for acc in accept:
if line.count(acc):

Powered by Google App Engine
This is Rietveld 408576698