Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(693)

Unified Diff: pylib/gyp/__init__.py

Issue 159605: This changes variable expansion so that it is recursive (Closed) Base URL: http://gyp.googlecode.com/svn/trunk/
Patch Set: '' Created 11 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pylib/gyp/input.py » ('j') | pylib/gyp/input.py » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pylib/gyp/__init__.py
===================================================================
--- pylib/gyp/__init__.py (revision 555)
+++ pylib/gyp/__init__.py (working copy)
@@ -4,10 +4,21 @@
import gyp.input
import optparse
import os.path
+import sets
import shlex
import sys
+# Default debug modes for GYP
+debug = sets.Set([])
+# List of "official" debug modes, but you can use anything you like.
+DEBUG_GENERAL = 'general'
+DEBUG_VARIABLES = 'variables'
+
+def DebugOutput(mode, message):
+ if mode in gyp.debug:
+ print "%s: %s" % (mode.upper(), message)
+
def FindBuildFiles():
extension = '.gyp'
files = os.listdir(os.getcwd())
@@ -98,6 +109,10 @@
help='files to include in all loaded .gyp files')
parser.add_option('--depth', dest='depth', metavar='PATH',
help='set DEPTH gyp variable to a relative path to PATH')
+ parser.add_option('-d', '--debug', dest='debug', metavar='DEBUGMODE',
+ action='append', default=[], help='turn on a debugging '
+ 'mode for debugging GYP. Supported modes are "variables" '
+ 'and "general"')
parser.add_option('-S', '--suffix', dest='suffix', default='',
help='suffix to add to generated files')
parser.add_option('-G', dest='generator_flags', action='append', default=[],
@@ -122,6 +137,17 @@
(options, build_files) = parser.parse_args(args)
+ gyp.debug = sets.Set(options.debug)
+
+ # Do an extra check to avoid work when we're not debugging.
+ if DEBUG_GENERAL in gyp.debug:
+ DebugOutput(DEBUG_GENERAL, 'running with these options:')
+ for (option, value) in options.__dict__.items():
+ if isinstance(value, basestring):
+ DebugOutput(DEBUG_GENERAL, " %s: '%s'" % (option, value))
+ else:
+ DebugOutput(DEBUG_GENERAL, " %s: %s" % (option, str(value)))
+
if not options.formats:
# If no format was given on the command line, then check the env variable.
generate_formats = os.environ.get('GYP_GENERATORS', [])
@@ -206,7 +232,7 @@
if options.generator_flags:
gen_flags += options.generator_flags
generator_flags = NameValueListToDict(gen_flags)
-
+
# TODO: Remove this and the option after we've gotten folks to move to the
# generator flag.
if options.msvs_version:
« no previous file with comments | « no previous file | pylib/gyp/input.py » ('j') | pylib/gyp/input.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698