Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions apple-kbd-dat-icon-extract.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
#
# Copyright (C) 2012 Philip Belemezov <philip@belemezov.net>
#
Expand All @@ -24,7 +24,7 @@
parser.error("Please specify output dir using `-o'")


ICNS_HEADER = '\x69\x63\x6e\x73'
ICNS_HEADER = b'\x69\x63\x6e\x73'


def bufferToHex(buffer):
Expand Down Expand Up @@ -58,8 +58,7 @@ def writeIcon(filename, iconData):

def processIcons(data, outputDir):
if not os.path.exists(outputDir):
print "%s: Output directory %s doesn't exist, please create it first" \
% (prog, outputDir)
print(f"{prog}: Output directory {outputDir} doesn't exist, please create it first")
return 1

iconIndex = 1
Expand All @@ -71,7 +70,7 @@ def processIcons(data, outputDir):
assert iconLen == len(iconData)

filename = os.path.join(outputDir, 'icon%d.icns' % iconIndex)
print "%s: Writing icon file %s" % (prog, filename)
print(f"{prog}: Writing icon file {filename}")
writeIcon(filename, iconData)

iconIndex += 1
Expand All @@ -84,7 +83,7 @@ def main():
else:
filename = args[0]

print "%s: Reading %s" % (prog, filename)
print(f"{prog}: Reading {filename}")
data = None
with open(filename, "rb") as f:
data = f.read()
Expand Down