diff options
author | Jed Brown <jed@jedbrown.org> | 2014-08-26 11:37:35 -0600 |
---|---|---|
committer | Jed Brown <jed@jedbrown.org> | 2014-08-26 11:37:35 -0600 |
commit | 26b6b225b60a57506115d0a707bded11e5a245ff (patch) | |
tree | 4c2e9f198378dd9b75e644006c2e09d6e40ff622 /git-fat | |
parent | 85da17389833c44f0bf69fa64faa4c58c32c16c7 (diff) | |
download | git-fat-26b6b225b60a57506115d0a707bded11e5a245ff.tar.gz |
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
Diffstat (limited to 'git-fat')
-rwxr-xr-x | git-fat | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -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() |