Skip to content

Commit

Permalink
[build] Remove gyp usage from landmines script
Browse files Browse the repository at this point in the history
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/925683
Reviewed-by: Bruce Dawson <brucedawson@chromium.org>
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
Reviewed-by: Nico Weber <thakis@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Commit-Queue: Michael Achenbach <machenbach@chromium.org>
Cr-Commit-Position: refs/heads/master@{#537929}
  • Loading branch information
mi-ac authored and Commit Bot committed Feb 20, 2018
1 parent e577c46 commit d2fc4b9
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 76 deletions.
72 changes: 0 additions & 72 deletions build/landmine_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,73 +3,21 @@
# found in the LICENSE file.


import functools
import logging
import os
import shlex
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():
return sys.platform in ['win32', 'cygwin']


@memoize()
def IsLinux():
return sys.platform.startswith(('linux', 'freebsd', 'netbsd', 'openbsd'))


@memoize()
def IsMac():
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():
"""
Returns a string representing the host_os of the current system.
Expand All @@ -83,23 +31,3 @@ def host_os():
return 'mac'
else:
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'
5 changes: 1 addition & 4 deletions build/landmines.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@

import difflib
import errno
import gyp_environment
import logging
import optparse
import os
Expand All @@ -52,7 +51,7 @@ def get_build_dir(src_dir):
if not output_dir:
raise Error('CHROMIUM_OUT_DIR environment variable is set but blank!')
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))


Expand Down Expand Up @@ -132,8 +131,6 @@ def process_options():
def main():
options = process_options()

gyp_environment.SetEnvironment()

landmines = []
for s in options.landmine_scripts:
proc = subprocess.Popen([sys.executable, s], stdout=subprocess.PIPE)
Expand Down

0 comments on commit d2fc4b9

Please sign in to comment.