From 073c24b5d2361857b8ce8b5dcd81a3e26fc05b96 Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Wed, 27 Jun 2018 13:45:09 -0700 Subject: [PATCH 91/92] Modify gpt-header-move and msdos-overlap to work with py2 or py3 Distributions are starting to remove python2 and only use python3. Modify these test scripts so that they will work with either python 2.7 or python 3.X --- tests/gpt-header-move | 15 ++++++++------- tests/msdos-overlap | 5 ++--- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/tests/gpt-header-move b/tests/gpt-header-move index 05cdc65..3dda5cb 100755 --- a/tests/gpt-header-move +++ b/tests/gpt-header-move @@ -3,20 +3,21 @@ # open img file, subtract 33 from altlba address, and move the last 33 sectors # back by 33 sectors -from struct import * +from struct import unpack_from, pack_into from zipfile import crc32 import array import sys + file = open(sys.argv[1],'rb+') file.seek(512) gptheader = file.read(512) -altlba = unpack_from('" + print("%s: " % sys.argv[0]) sys.exit(1) -data = "".join(chr(c) for c in BAD_ENTRY) with open(sys.argv[1], "rb+") as f: f.seek(OFFSET, 0) - f.write(data) + f.write(bytes(bytearray(BAD_ENTRY))) sys.exit(0) -- 2.17.1