aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJacek Antonelli2010-03-12 00:31:20 -0600
committerJacek Antonelli2010-03-13 01:29:24 -0600
commit787f722f74b93bc0f803e9ef9aecaa08e4387402 (patch)
treed3d8def4199e290f2460a2481e006a6914a86863
parentChangeLog.txt is now generated from the Git log at compile time. (diff)
downloadmeta-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-xlinden/scripts/make_changelog.py34
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
54import commands, re, os.path, sys 54import commands, re, os, sys
55from string import Template 55from 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("""
312Date: {ad} ({id}) 312Date: %(ad)s (%(id)s)
313Author: {an} <{ae}>""".format(ad = self.author_date, 313Author: %(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
431if __name__ == "__main__": 437if __name__ == "__main__":