From a235e85cc8bc308a7dbf414f6594a9d309f13289 Mon Sep 17 00:00:00 2001 From: Brandon Casey <drafnel@gmail.com> Date: Sat, 26 Jan 2013 11:14:33 -0800 Subject: git-p4.py: support Python 2.4 Python 2.4 lacks the following features: subprocess.check_call struct.pack_into Take a cue from 460d1026 and provide an implementation of the CalledProcessError exception. Then replace the calls to subproccess.check_call with calls to subprocess.call that check the return status and raise a CalledProcessError exception if necessary. The struct.pack_into in t/9802 can be converted into a single struct.pack call which is available in Python 2.4. Signed-off-by: Brandon Casey <bcasey@nvidia.com> Acked-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com> --- t/t9802-git-p4-filetype.sh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 't') diff --git a/t/t9802-git-p4-filetype.sh b/t/t9802-git-p4-filetype.sh index 21924dfd7..aae1a3f81 100755 --- a/t/t9802-git-p4-filetype.sh +++ b/t/t9802-git-p4-filetype.sh @@ -105,12 +105,13 @@ build_gendouble() { cat >gendouble.py <<-\EOF import sys import struct - import array - s = array.array("c", '\0' * 26) - struct.pack_into(">L", s, 0, 0x00051607) # AppleDouble - struct.pack_into(">L", s, 4, 0x00020000) # version 2 - s.tofile(sys.stdout) + s = struct.pack(">LL18s", + 0x00051607, # AppleDouble + 0x00020000, # version 2 + "" # pad to 26 bytes + ) + sys.stdout.write(s) EOF } -- cgit v1.2.1