Permalink
Browse files

Make root invocation less crazy so that multiprocessing works on Windows

Previously gyp.bat runs "python gyp" and "gyp" imports "gyp" expecting to
get pylib/gyp/__init__.py. Multiprocessing tries to fork and doesn't find
the entry point named gyp because it doesn't search for non-.py
extensions.

Instead, make non-Windows match with a wrapper 'gyp' in bash, and make the
python entry point gyp_main.py so that importing works more normally.

Also, remove "Using parallel processing..." message so that tests pass,
otherwise they complain that there was output on stderr. This was failing
on other OSs too.

R=thakis@chromium.org
BUG=154205

Review URL: https://codereview.chromium.org/18271010

git-svn-id: http://gyp.googlecode.com/svn/trunk@1667 78cadc50-ecff-11dd-a971-7dbc132099af
  • Loading branch information...
1 parent 423512d commit 7ebf72ab00fe6f66934d857bdaff2e0475de03bf scottmg@chromium.org committed Jul 8, 2013
Showing with 26 additions and 20 deletions.
  1. +7 −18 gyp
  2. +1 −1 gyp.bat
  3. +18 −0 gyp_main.py
  4. +0 −1 pylib/gyp/input.py
View
@@ -1,18 +1,7 @@
-#!/usr/bin/env python
-
-# Copyright (c) 2009 Google Inc. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-import sys
-
-# TODO(mark): sys.path manipulation is some temporary testing stuff.
-try:
- import gyp
-except ImportError, e:
- import os.path
- sys.path.append(os.path.join(os.path.dirname(sys.argv[0]), 'pylib'))
- import gyp
-
-if __name__ == '__main__':
- sys.exit(gyp.main(sys.argv[1:]))
+#!/usr/bin/bash
+# Copyright 2013 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+BASE=`dirname $0`
+python $BASE/gyp_main.py
View
@@ -2,4 +2,4 @@
@rem Use of this source code is governed by a BSD-style license that can be
@rem found in the LICENSE file.
-@python "%~dp0/gyp" %*
+@python "%~dp0gyp_main.py" %*
View
@@ -0,0 +1,18 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import sys
+
+# TODO(mark): sys.path manipulation is some temporary testing stuff.
+try:
+ import gyp
+except ImportError, e:
+ import os.path
+ sys.path.append(os.path.join(os.path.dirname(sys.argv[0]), 'pylib'))
+ import gyp
+
+if __name__ == '__main__':
+ sys.exit(gyp.main(sys.argv[1:]))
View
@@ -2565,7 +2565,6 @@ def Load(build_files, variables, includes, depth, generator_input_info, check,
build_file = os.path.normpath(build_file)
try:
if parallel:
- print >>sys.stderr, 'Using parallel processing.'
LoadTargetBuildFileParallel(build_file, data, aux_data,
variables, includes, depth, check)
else:

0 comments on commit 7ebf72a

Please sign in to comment.