From 26b6b225b60a57506115d0a707bded11e5a245ff Mon Sep 17 00:00:00 2001 From: Jed Brown Date: Tue, 26 Aug 2014 11:37:35 -0600 Subject: Fix syntax and error cleanly on Python-3 Python-3 requires careful handling of unicode to avoid breaking Git semantics (which manages strings unencoded) or Python (which insists on processing encoded strings on Windows). This is not done yet, so error cleanly for now. See discussion in issue #42. Suggested-by: Christoph Buchner --- git-fat | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'git-fat') diff --git a/git-fat b/git-fat index 4a95d9e..dd6af72 100755 --- a/git-fat +++ b/git-fat @@ -15,6 +15,10 @@ import threading import time import collections +if not type(sys.version_info) is tuple and sys.version_info.major > 2: + sys.stderr.write('git-fat does not support Python-3 yet. Please use python2.\n') + sys.exit(1) + try: from subprocess import check_output del check_output @@ -533,7 +537,7 @@ class GitFat(object): time1 = time.time() self.verbose('Found %d paths in %.3f s' % (len(pathsizes), time1-time0)) maxlen = max(map(len,pathsizes)) if pathsizes else 0 - for path, sizes in sorted(pathsizes.items(), cmp=lambda (p1,s1),(p2,s2): cmp(max(s1),max(s2)), reverse=True): + for path, sizes in sorted(pathsizes.items(), key=lambda p,s: max(s), reverse=True): print('%-*s filter=fat -text # %10d %d' % (maxlen, path,max(sizes),len(sizes))) revlist.wait() difftree.wait() -- cgit v1.2.1