From df526679507c205b7718750054f088ba1f251c4e Mon Sep 17 00:00:00 2001 From: Anthony Sottile Date: Mon, 23 Jun 2014 14:09:42 -0700 Subject: [PATCH] Fix writing tarfile with unicode filename in python 2.6 --- pre_commit/make_archives.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pre_commit/make_archives.py b/pre_commit/make_archives.py index e989750b..4bae338c 100644 --- a/pre_commit/make_archives.py +++ b/pre_commit/make_archives.py @@ -49,7 +49,9 @@ def make_archive(name, repo, ref, destdir): # We don't want the '.git' directory shutil.rmtree(os.path.join(tempdir, '.git')) - with tarfile_open(output_path, 'w|gz') as tf: + # XXX: py2.6 derps if filename is unicode while writing + # XXX: str() is used to preserve behavior in py3 + with tarfile_open(str(output_path), 'w|gz') as tf: tf.add(tempdir, name) return output_path