Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions gitwalker/git.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import subprocess
import os.path
from util import log, CmdError
from datetime import datetime

from util import get_output
Expand Down
4 changes: 2 additions & 2 deletions gitwalker/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ def main():
log("[%s] %s", cmd.name, pprint.pformat(rec["results"][cmd.name]))
out[sha1] = rec

log("Writing output file: %s", opts.out_path)
json.dump(out, open(opts.out_path, "w"), indent=1)
log("Writing output file: %s", out_path)
json.dump(out, open(out_path, "w"), indent=1)
finally:
log("Tidying temp dir: %s", git_new)
shutil.rmtree(git_new)
Expand Down
7 changes: 5 additions & 2 deletions gitwalker/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,12 @@ def run(self, path):
if not os.path.exists(os.path.join(path, self.fname)):
raise IOError("Couldn't find TeX file: %s" % self.fname)
(out, wc) = self.word_count(path, self.fname)
if not "total" in wc:
if "total" in wc:
return self.extract_wordcount(wc["total"])
elif len(wc) == 1:
return self.extract_wordcount(wc[wc.keys()[0]])
else:
raise ValueError("Error parsing output: %s" % out)
else: return self.extract_wordcount(wc["total"])

class ShellCmd(Cmd):
""" Execute a shell command """
Expand Down