Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
gyp: update to r1214
Browse files Browse the repository at this point in the history
  • Loading branch information
bnoordhuis committed Feb 20, 2012
1 parent 7ae0d47 commit 4af673e
Show file tree
Hide file tree
Showing 130 changed files with 3,936 additions and 1,529 deletions.
43 changes: 1 addition & 42 deletions tools/gyp/buildbot/buildbot_run.py
@@ -1,5 +1,5 @@
#!/usr/bin/env python
# Copyright (c) 2011 Google Inc. All rights reserved.
# Copyright (c) 2012 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.

Expand All @@ -23,32 +23,6 @@
TRUNK_DIR = os.path.dirname(BUILDBOT_DIR)
ROOT_DIR = os.path.dirname(TRUNK_DIR)
OUT_DIR = os.path.join(TRUNK_DIR, 'out')
NINJA_PATH = os.path.join(TRUNK_DIR, 'ninja' + EXE_SUFFIX)
NINJA_WORK_DIR = os.path.join(ROOT_DIR, 'ninja_work')


def InstallNinja():
"""Install + build ninja.
Returns:
0 for success, 1 for failure.
"""
print '@@@BUILD_STEP install ninja@@@'
# Delete old version if any.
try:
shutil.rmtree(NINJA_WORK_DIR, ignore_errors=True)
except:
pass
# Sync new copy from git.
subprocess.check_call(
'git clone https://github.com/martine/ninja.git ' + NINJA_WORK_DIR,
shell=True)
# Bootstrap.
subprocess.check_call('./bootstrap.sh', cwd=NINJA_WORK_DIR, shell=True)
# Copy out ninja.
shutil.copyfile(os.path.join(NINJA_WORK_DIR, 'ninja' + EXE_SUFFIX),
NINJA_PATH)
os.chmod(NINJA_PATH, 0777)


def GypTestFormat(title, format=None, msvs_version=None):
Expand All @@ -64,17 +38,6 @@ def GypTestFormat(title, format=None, msvs_version=None):
if not format:
format = title

# Install ninja if needed.
# NOTE: as ninja gets installed each time, regressions to ninja can come
# either from changes to ninja itself, or changes to gyp.
if format == 'ninja':
try:
InstallNinja()
except Exception, e:
print '@@@STEP_FAILURE@@@'
print str(e)
return 1

print '@@@BUILD_STEP ' + title + '@@@'
sys.stdout.flush()
env = os.environ.copy()
Expand Down Expand Up @@ -104,10 +67,6 @@ def GypBuild():
print '@@@BUILD_STEP cleanup@@@'
print 'Removing %s...' % OUT_DIR
shutil.rmtree(OUT_DIR, ignore_errors=True)
print 'Removing %s...' % NINJA_WORK_DIR
shutil.rmtree(NINJA_WORK_DIR, ignore_errors=True)
print 'Removing %s...' % NINJA_PATH
shutil.rmtree(NINJA_PATH, ignore_errors=True)
print 'Done.'

retcode = 0
Expand Down
4 changes: 2 additions & 2 deletions tools/gyp/gyptest.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python

# Copyright (c) 2011 Google Inc. All rights reserved.
# Copyright (c) 2012 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.

Expand Down Expand Up @@ -209,7 +209,7 @@ def main(argv=None):
'freebsd7': ['make'],
'freebsd8': ['make'],
'cygwin': ['msvs'],
'win32': ['msvs'],
'win32': ['msvs', 'ninja'],
'linux2': ['make', 'ninja'],
'linux3': ['make', 'ninja'],
'darwin': ['make', 'ninja', 'xcode'],
Expand Down
29 changes: 28 additions & 1 deletion tools/gyp/pylib/gyp/common.py
@@ -1,7 +1,9 @@
# Copyright (c) 2011 Google Inc. All rights reserved.
# Copyright (c) 2012 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.

from __future__ import with_statement

import errno
import filecmp
import os.path
Expand Down Expand Up @@ -347,6 +349,8 @@ def close(self):
def GetFlavor(params):
"""Returns |params.flavor| if it's set, the system's default flavor else."""
flavors = {
'cygwin': 'win',
'win32': 'win',
'darwin': 'mac',
'sunos5': 'solaris',
'freebsd7': 'freebsd',
Expand All @@ -356,6 +360,29 @@ def GetFlavor(params):
return params.get('flavor', flavor)


def CopyTool(flavor, out_path):
"""Finds (mac|sun)_tool.gyp in the gyp directory and copies it
to |out_path|."""
prefix = { 'solaris': 'sun', 'mac': 'mac' }.get(flavor, None)
if not prefix:
return

# Slurp input file.
source_path = os.path.join(
os.path.dirname(os.path.abspath(__file__)), '%s_tool.py' % prefix)
with open(source_path) as source_file:
source = source_file.readlines()

# Add header and write it out.
tool_path = os.path.join(out_path, 'gyp-%s-tool' % prefix)
with open(tool_path, 'w') as tool_file:
tool_file.write(
''.join([source[0], '# Generated by gyp. Do not edit.\n'] + source[1:]))

# Make file executable.
os.chmod(tool_path, 0755)


# From Alex Martelli,
# http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52560
# ASPN: Python Cookbook: Remove duplicates from a sequence
Expand Down
8 changes: 4 additions & 4 deletions tools/gyp/pylib/gyp/generator/dump_dependency_json.py
Expand Up @@ -20,15 +20,15 @@
'RULE_INPUT_DIRNAME', 'RULE_INPUT_EXT',
'EXECUTABLE_PREFIX', 'EXECUTABLE_SUFFIX',
'STATIC_LIB_PREFIX', 'STATIC_LIB_SUFFIX',
'SHARED_LIB_PREFIX', 'SHARED_LIB_SUFFIX',
'LINKER_SUPPORTS_ICF']:
'SHARED_LIB_PREFIX', 'SHARED_LIB_SUFFIX']:
generator_default_variables[unused] = ''


def CalculateVariables(default_variables, params):
generator_flags = params.get('generator_flags', {})
default_variables['OS'] = generator_flags.get(
'os', gyp.common.GetFlavor(params))
for key, val in generator_flags.items():
default_variables.setdefault(key, val)
default_variables.setdefault('OS', gyp.common.GetFlavor(params))


def CalculateGeneratorInputInfo(params):
Expand Down

0 comments on commit 4af673e

Please sign in to comment.