Commit d2fc4b94 authored by Michael Achenbach's avatar Michael Achenbach Committed by Commit Bot

[build] Remove gyp usage from landmines script

References from client projects to removed methods have been removed in
previous CLs.

Bug: 756691
Change-Id: I405ec09301455884f00348aadf82e865e85df721
Reviewed-on: https://chromium-review.googlesource.com/925683Reviewed-by: default avatarBruce Dawson <brucedawson@chromium.org>
Reviewed-by: default avatarRobbie Iannucci <iannucci@chromium.org>
Reviewed-by: default avatarNico Weber <thakis@chromium.org>
Reviewed-by: default avatarDirk Pranke <dpranke@chromium.org>
Commit-Queue: Michael Achenbach <machenbach@chromium.org>
Cr-Commit-Position: refs/heads/master@{#537929}
parent e577c468
...@@ -3,73 +3,21 @@ ...@@ -3,73 +3,21 @@
# found in the LICENSE file. # found in the LICENSE file.
import functools
import logging
import os
import shlex
import sys import sys
def memoize(default=None):
"""This decorator caches the return value of a parameterless pure function"""
def memoizer(func):
val = []
@functools.wraps(func)
def inner():
if not val:
ret = func()
val.append(ret if ret is not None else default)
if logging.getLogger().isEnabledFor(logging.INFO):
print '%s -> %r' % (func.__name__, val[0])
return val[0]
return inner
return memoizer
@memoize()
def IsWindows(): def IsWindows():
return sys.platform in ['win32', 'cygwin'] return sys.platform in ['win32', 'cygwin']
@memoize()
def IsLinux(): def IsLinux():
return sys.platform.startswith(('linux', 'freebsd', 'netbsd', 'openbsd')) return sys.platform.startswith(('linux', 'freebsd', 'netbsd', 'openbsd'))
@memoize()
def IsMac(): def IsMac():
return sys.platform == 'darwin' return sys.platform == 'darwin'
@memoize()
def gyp_defines():
"""Parses and returns GYP_DEFINES env var as a dictionary."""
return dict(arg.split('=', 1)
for arg in shlex.split(os.environ.get('GYP_DEFINES', '')))
@memoize()
def gyp_generator_flags():
"""Parses and returns GYP_GENERATOR_FLAGS env var as a dictionary."""
return dict(arg.split('=', 1)
for arg in shlex.split(os.environ.get('GYP_GENERATOR_FLAGS', '')))
@memoize()
def gyp_msvs_version():
return os.environ.get('GYP_MSVS_VERSION', '')
@memoize()
def distributor():
"""
Returns a string which is the distributed build engine in use (if any).
Possible values: 'goma', None
"""
if 'goma' in gyp_defines():
return 'goma'
def host_os(): def host_os():
""" """
Returns a string representing the host_os of the current system. Returns a string representing the host_os of the current system.
...@@ -83,23 +31,3 @@ def host_os(): ...@@ -83,23 +31,3 @@ def host_os():
return 'mac' return 'mac'
else: else:
return 'unknown' return 'unknown'
# TODO(machenbach): Deprecate this method as it depends on env variables.
@memoize()
def platform():
"""
Returns a string representing the platform this build is targeted for.
Possible values: 'win', 'mac', 'linux', 'ios', 'android'
"""
if 'OS' in gyp_defines():
if 'android' in gyp_defines()['OS']:
return 'android'
else:
return gyp_defines()['OS']
elif IsWindows():
return 'win'
elif IsLinux():
return 'linux'
else:
return 'mac'
...@@ -25,7 +25,6 @@ troublesome alternatives. ...@@ -25,7 +25,6 @@ troublesome alternatives.
import difflib import difflib
import errno import errno
import gyp_environment
import logging import logging
import optparse import optparse
import os import os
...@@ -52,7 +51,7 @@ def get_build_dir(src_dir): ...@@ -52,7 +51,7 @@ def get_build_dir(src_dir):
if not output_dir: if not output_dir:
raise Error('CHROMIUM_OUT_DIR environment variable is set but blank!') raise Error('CHROMIUM_OUT_DIR environment variable is set but blank!')
else: else:
output_dir = landmine_utils.gyp_generator_flags().get('output_dir', 'out') output_dir = 'out'
return os.path.abspath(os.path.join(src_dir, output_dir)) return os.path.abspath(os.path.join(src_dir, output_dir))
...@@ -132,8 +131,6 @@ def process_options(): ...@@ -132,8 +131,6 @@ def process_options():
def main(): def main():
options = process_options() options = process_options()
gyp_environment.SetEnvironment()
landmines = [] landmines = []
for s in options.landmine_scripts: for s in options.landmine_scripts:
proc = subprocess.Popen([sys.executable, s], stdout=subprocess.PIPE) proc = subprocess.Popen([sys.executable, s], stdout=subprocess.PIPE)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment