From 0e70861c9f72fb2e06f9a121e6dac0e542ee1230 Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Wed, 27 Jun 2018 13:45:09 -0700 Subject: [PATCH 82/86] 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