Index: chrome/build_nacl_irt.py |
=================================================================== |
--- chrome/build_nacl_irt.py (revision 97773) |
+++ chrome/build_nacl_irt.py (working copy) |
@@ -3,6 +3,17 @@ |
# Use of this source code is governed by a BSD-style license that can be |
# found in the LICENSE file. |
noelallen_use_chromium
2011/08/23 21:42:05
Clean out plz.
bradn
2011/08/23 21:53:48
Done.
|
+#import sys |
Mark Seaborn
2011/08/23 21:42:21
Don't forget to remove this.
bradn
2011/08/23 21:53:48
Done.
|
+#sys.stderr.write('AAAAAAA\n') |
+#import os |
+#print os.isatty(0) |
+#print os.isatty(1) |
+#print os.isatty(2) |
+#print "here" |
+#sys.stdout.flush() |
+#import readline |
+#sys.stderr.write('BBBBBBB\n') |
+ |
import optparse |
import os |
import re |
@@ -79,11 +90,16 @@ |
filename = GPU_CMD_BUFFER_DIR + filename[len(NACL_CMD_BUFFER_DIR):] |
inputs.add(filename) |
# Check that everything exists and make it script relative. |
+ # Exclude things above SRC_DIR. |
rel_inputs = set() |
for f in inputs: |
nf = os.path.join(NACL_DIR, f) |
if not os.path.exists(nf): |
raise Exception('missing input file "%s"' % nf) |
+ # If the relative path from SRC_DIR to the file starts with ../ ignore it. |
+ # (i.e. the file is outside the client). |
+ if RelativePath(nf, SRC_DIR).startswith('..' + os.sep): |
+ continue |
rel_inputs.add(RelativePath(nf, SCRIPT_DIR)) |
# Print it sorted. |
rel_inputs = sorted(list(rel_inputs)) |
@@ -98,6 +114,8 @@ |
platforms: list of platform names to build for. |
out_dir: directory to output the IRT to. |
""" |
+ # Make out_dir absolute. |
+ out_dir = os.path.abspath(out_dir) |
# Clean. |
scons_out = os.path.join(NACL_DIR, 'scons-out') |
if os.path.exists(scons_out): |
@@ -110,7 +128,15 @@ |
'scons-out/nacl_irt-' + platform + '/staging/irt.nexe', |
] |
print 'Running: ' + ' '.join(cmd) |
- p = subprocess.Popen(cmd, cwd=NACL_DIR) |
+ os.chdir(NACL_DIR) |
+ # Work around the fact that python's readline module (used by scons), |
+ # attempts to alter file handle state on stdin in a way that blocks if |
+ # a process is not the primary owner of a terminal on OSX. |
Mark Seaborn
2011/08/23 21:42:21
"not a member of a foreground job on a tty"?
e.g.
bradn
2011/08/23 21:53:48
Done.
|
+ if sys.platform == 'darwin': |
+ devnull = open(os.devnull, 'rb').fileno() |
Mark Seaborn
2011/08/23 21:42:21
open(os.devnull, 'rb').fileno() is wrong: the file
bradn
2011/08/23 21:53:48
Done.
|
+ else: |
+ devnull = None |
+ p = subprocess.Popen(cmd, cwd=NACL_DIR, stdin=devnull) |
Mark Seaborn
2011/08/23 21:42:21
Use either cwd= or chdir() but not both?
bradn
2011/08/23 21:53:48
Done.
|
p.wait() |
if p.returncode != 0: |
sys.exit(3) |
Property changes on: chrome/build_nacl_irt.py |
___________________________________________________________________ |
Added: svn:executable |
+ * |