summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorfischman@chromium.org <fischman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-07 00:33:47 +0000
committerfischman@chromium.org <fischman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-07 00:33:47 +0000
commit8370700b74f54a2de38502a7e56128bac0e4a8b8 (patch)
tree081d04ef34cffa86f2d64e5adf03c0ef7fb062e6 /tools
parent6e9024479c5fc57d51303236fac24e7c35fb5d0a (diff)
downloadchromium_src-8370700b74f54a2de38502a7e56128bac0e4a8b8.zip
chromium_src-8370700b74f54a2de38502a7e56128bac0e4a8b8.tar.gz
chromium_src-8370700b74f54a2de38502a7e56128bac0e4a8b8.tar.bz2
dump-static-initializers.py: Don't try to use git when not in a git checkout.
BUG=none TEST=none Review URL: https://chromiumcodereview.appspot.com/9347002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@120653 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools')
-rwxr-xr-xtools/linux/dump-static-initializers.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/tools/linux/dump-static-initializers.py b/tools/linux/dump-static-initializers.py
index 416bca2..61261cb8 100755
--- a/tools/linux/dump-static-initializers.py
+++ b/tools/linux/dump-static-initializers.py
@@ -34,6 +34,10 @@ NOTES = {
'std::__ioinit': '#includes <iostream>, use <ostream> instead',
}
+# Determine whether this is a git checkout (as opposed to e.g. svn).
+IS_GIT_WORKSPACE = (subprocess.Popen(
+ ['git', 'rev-parse'], stderr=subprocess.PIPE).wait() == 0)
+
class Demangler(object):
"""A wrapper around c++filt to provide a function to demangle symbols."""
def __init__(self):
@@ -52,6 +56,8 @@ def QualifyFilenameAsProto(filename):
"""Attempt to qualify a bare |filename| with a src-relative path, assuming it
is a protoc-generated file. If a single match is found, it is returned.
Otherwise the original filename is returned."""
+ if not IS_GIT_WORKSPACE:
+ return filename
match = protobuf_filename_re.match(filename)
if not match:
return filename
@@ -77,6 +83,8 @@ def QualifyFilename(filename, symbol):
"""Given a bare filename and a symbol that occurs in it, attempt to qualify
it with a src-relative path. If more than one file matches, return the
original filename."""
+ if not IS_GIT_WORKSPACE:
+ return filename
match = symbol_code_name_re.match(symbol)
if not match:
return filename