Skip to content

Commit

Permalink
Make root invocation less crazy so that multiprocessing works on Windows
Browse files Browse the repository at this point in the history
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
scottmg@chromium.org committed Jul 8, 2013
1 parent 423512d commit 7ebf72a
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 20 deletions.
25 changes: 7 additions & 18 deletions 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
2 changes: 1 addition & 1 deletion gyp.bat
Expand Up @@ -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" %*
18 changes: 18 additions & 0 deletions 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:]))
1 change: 0 additions & 1 deletion pylib/gyp/input.py
Expand Up @@ -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:
Expand Down

0 comments on commit 7ebf72a

Please sign in to comment.