diff options
author | Jacek Antonelli | 2010-03-12 00:31:20 -0600 |
---|---|---|
committer | Jacek Antonelli | 2010-03-13 01:29:24 -0600 |
commit | 787f722f74b93bc0f803e9ef9aecaa08e4387402 (patch) | |
tree | d3d8def4199e290f2460a2481e006a6914a86863 | |
parent | ChangeLog.txt is now generated from the Git log at compile time. (diff) | |
download | meta-impy-787f722f74b93bc0f803e9ef9aecaa08e4387402.zip meta-impy-787f722f74b93bc0f803e9ef9aecaa08e4387402.tar.gz meta-impy-787f722f74b93bc0f803e9ef9aecaa08e4387402.tar.bz2 meta-impy-787f722f74b93bc0f803e9ef9aecaa08e4387402.tar.xz |
Tweaked make_changelog.py to work on Mac.
Compatibility with older python and git versions, and set PATH
to try to find git executable in likely locations.
@nochangelog
Diffstat (limited to '')
-rwxr-xr-x | linden/scripts/make_changelog.py | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/linden/scripts/make_changelog.py b/linden/scripts/make_changelog.py index 759dffd..8c21392 100755 --- a/linden/scripts/make_changelog.py +++ b/linden/scripts/make_changelog.py | |||
@@ -51,7 +51,7 @@ | |||
51 | 51 | ||
52 | 52 | ||
53 | 53 | ||
54 | import commands, re, os.path, sys | 54 | import commands, re, os, sys |
55 | from string import Template | 55 | from string import Template |
56 | 56 | ||
57 | 57 | ||
@@ -309,16 +309,15 @@ class LogEntry: | |||
309 | texts=[LogEntry.separator] | 309 | texts=[LogEntry.separator] |
310 | 310 | ||
311 | texts.append(""" | 311 | texts.append(""" |
312 | Date: {ad} ({id}) | 312 | Date: %(ad)s (%(id)s) |
313 | Author: {an} <{ae}>""".format(ad = self.author_date, | 313 | Author: %(an)s <%(ae)s>""" % { "ad" : self.author_date, |
314 | an = self.author_name, | 314 | "an" : self.author_name, |
315 | ae = self.author_mail, | 315 | "ae" : self.author_mail, |
316 | id = self.id[0:7])) | 316 | "id" : self.id[0:7] }) |
317 | 317 | ||
318 | if self.commit_name != self.author_name: | 318 | if self.commit_name != self.author_name: |
319 | texts.append("Committer: {cn} <{ce}>".format( | 319 | texts.append("Committer: %(cn)s <%(ce)s>" % { "cn" : self.commit_name, |
320 | cn = self.commit_name, | 320 | "ce" : self.commit_mail }) |
321 | ce = self.commit_mail)) | ||
322 | 321 | ||
323 | texts.append("\n") | 322 | texts.append("\n") |
324 | 323 | ||
@@ -370,16 +369,21 @@ def main(): | |||
370 | commits = "HEAD" | 369 | commits = "HEAD" |
371 | 370 | ||
372 | 371 | ||
372 | # Set PATH to help find the git executable on Mac OS X. | ||
373 | if os.uname()[0] == "Darwin": | ||
374 | os.environ["PATH"] += ":/usr/local/bin:/usr/local/git/bin:/sw/bin:/opt/bin:~/bin" | ||
375 | |||
373 | # Fetch the log entries from git in one big chunk. | 376 | # Fetch the log entries from git in one big chunk. |
374 | cmd = "git log --pretty=fuller --name-status --date=short --date-order --show-notes {commits}".format(commits = commits) | 377 | cmd = "git log --pretty=fuller --name-status --date=short --date-order " + commits |
375 | status, output = commands.getstatusoutput(cmd) | 378 | status, output = commands.getstatusoutput(cmd) |
376 | 379 | ||
377 | 380 | ||
378 | # If the git command failed, write a placeholder ChangeLog.txt and exit. | 381 | # If the git command failed, write a placeholder ChangeLog.txt and exit. |
379 | if status != 0: | 382 | if status != 0: |
380 | print "Could not generate ChangeLog.txt: " + output | 383 | print "Could not generate ChangeLog.txt: " + output |
381 | with open(CHANGELOG, "w") as changelog: | 384 | changelog = open(CHANGELOG, "w") |
382 | changelog.write("\n (Imprudence must be compiled from a Git repository to generate a ChangeLog.)\n\n") | 385 | changelog.write( output + "\n (Imprudence must be compiled from a Git repository to generate a ChangeLog.)\n\n") |
386 | changelog.close() | ||
383 | exit(0) | 387 | exit(0) |
384 | 388 | ||
385 | 389 | ||
@@ -424,8 +428,10 @@ def main(): | |||
424 | 428 | ||
425 | text = "\n".join(output) | 429 | text = "\n".join(output) |
426 | 430 | ||
427 | with open(CHANGELOG, "w") as changelog: | 431 | changelog = open(CHANGELOG, "w") |
428 | changelog.write(text) | 432 | changelog.write(text) |
433 | changelog.close() | ||
434 | |||
429 | 435 | ||
430 | 436 | ||
431 | if __name__ == "__main__": | 437 | if __name__ == "__main__": |