summaryrefslogtreecommitdiffstats
path: root/build/util
diff options
context:
space:
mode:
authorscottmg@google.com <scottmg@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-01 20:05:19 +0000
committerscottmg@google.com <scottmg@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-01 20:05:19 +0000
commit21327e7ca0b5be826fa853c5c6674648d5cd0788 (patch)
treea486e84b6527ba962293c4ebc091a76a4e3b08f0 /build/util
parentf0c023ee16b2ba3023794be9bd54793c4f561c69 (diff)
downloadchromium_src-21327e7ca0b5be826fa853c5c6674648d5cd0788.zip
chromium_src-21327e7ca0b5be826fa853c5c6674648d5cd0788.tar.gz
chromium_src-21327e7ca0b5be826fa853c5c6674648d5cd0788.tar.bz2
Fix lastchange.py when running on native win32 python
When running as runhooks, it's not run via cygwin like it was when run in the build, and isn't able to find git. I believe the test that checked for both cygwin and win32 before was incorrect (but was always run via cygwin before so didn't matter). Additionally, when runhooks runs it, it's from above src/, so the cwd isn't in the repo. So, pass in the directory of the script itself so that git can find its repo. BUG=112264 Review URL: https://chromiumcodereview.appspot.com/9317037 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@120089 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'build/util')
-rwxr-xr-xbuild/util/lastchange.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/build/util/lastchange.py b/build/util/lastchange.py
index df8bcf8..d419f92 100755
--- a/build/util/lastchange.py
+++ b/build/util/lastchange.py
@@ -73,17 +73,20 @@ def RunGitCommand(directory, command):
A process object or None.
"""
command = ['git'] + command
- # Force shell usage under cygwin & win32. This is a workaround for
+ shell = True
+ # Force shell usage under cygwin. This is a workaround for
# mysterious loss of cwd while invoking cygwin's git.
# We can't just pass shell=True to Popen, as under win32 this will
# cause CMD to be used, while we explicitly want a cygwin shell.
- if sys.platform in ('cygwin', 'win32'):
+ if sys.platform == 'cygwin':
command = ['sh', '-c', ' '.join(command)]
+ shell = False
try:
proc = subprocess.Popen(command,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
- cwd=directory)
+ cwd=directory,
+ shell=shell)
return proc
except OSError:
return None
@@ -207,7 +210,8 @@ def main(argv=None):
parser.print_help()
sys.exit(2)
- version_info = FetchVersionInfo(opts.default_lastchange)
+ version_info = FetchVersionInfo(opts.default_lastchange,
+ os.path.dirname(sys.argv[0]))
if version_info.revision == None:
version_info.revision = '0'