From 167d4df40b55f2e8b559a797bb93b09554a871d0 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Tue, 9 Nov 2010 16:10:52 +0000 Subject: Update Python scripts to work in Python 3. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 2162 --- pkg/wince/wince-cabgen | 40 ++++++++++++++++++---------------------- 1 file changed, 18 insertions(+), 22 deletions(-) (limited to 'pkg') diff --git a/pkg/wince/wince-cabgen b/pkg/wince/wince-cabgen index 97cba132..76845cf9 100755 --- a/pkg/wince/wince-cabgen +++ b/pkg/wince/wince-cabgen @@ -3,10 +3,11 @@ import os import re import shutil +import struct import sys import tempfile -CAB_HEADER = "MSCE" +CAB_HEADER = "MSCE".encode("ascii") ARCHITECTURES = { "shx-sh3": 103, @@ -58,16 +59,10 @@ DIR_VARIABLES = { } def write_int16(f, value): - b1 = value & 0xff - b2 = (value >> 8) & 0xff - f.write("%c%c" % (b1, b2)) + f.write(struct.pack("> 8) & 0xff - b3 = (value >> 16) & 0xff - b4 = (value >> 24) & 0xff - f.write("%c%c%c%c" % (b1, b2, b3, b4)) + f.write(struct.pack(" " % sys.argv[0] + print("Usage: %s " % sys.argv[0]) sys.exit(0) if sys.argv[1] == "-d": -- cgit v1.2.3