From 7ebf72ab00fe6f66934d857bdaff2e0475de03bf Mon Sep 17 00:00:00 2001 From: "scottmg@chromium.org" Date: Mon, 8 Jul 2013 22:36:01 +0000 Subject: [PATCH] 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 --- gyp | 25 +++++++------------------ gyp.bat | 2 +- gyp_main.py | 18 ++++++++++++++++++ pylib/gyp/input.py | 1 - 4 files changed, 26 insertions(+), 20 deletions(-) create mode 100644 gyp_main.py diff --git a/gyp b/gyp index d52e7116..ed09face 100755 --- a/gyp +++ b/gyp @@ -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 diff --git a/gyp.bat b/gyp.bat index 90fbc6d3..c0b4ca24 100755 --- a/gyp.bat +++ b/gyp.bat @@ -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" %* diff --git a/gyp_main.py b/gyp_main.py new file mode 100644 index 00000000..d52e7116 --- /dev/null +++ b/gyp_main.py @@ -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:])) diff --git a/pylib/gyp/input.py b/pylib/gyp/input.py index 625ae9bd..0d9beb0f 100644 --- a/pylib/gyp/input.py +++ b/pylib/gyp/input.py @@ -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: