mirror of
https://github.com/LIV2/amitools.git
synced 2025-12-06 06:32:47 +00:00
started Python3 conversion
This commit is contained in:
parent
4b93cbd9ad
commit
afac12b413
@ -1,7 +1,10 @@
|
||||
sudo: false
|
||||
language: python
|
||||
python:
|
||||
- "2.7"
|
||||
- "3.4"
|
||||
- "3.5"
|
||||
- "3.6"
|
||||
- "3.7"
|
||||
env:
|
||||
- PIP=pip
|
||||
|
||||
|
||||
18
README.md
18
README.md
@ -19,7 +19,7 @@ will be very helpful.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- Python ```2.7.x```
|
||||
- Python >= ```3.4```
|
||||
- pip
|
||||
|
||||
### Optional Packages
|
||||
@ -41,17 +41,9 @@ On macOS you have multiple ways of installing ```pip```:
|
||||
sudo easy_install pip
|
||||
```
|
||||
|
||||
#### MacPorts Package Manager
|
||||
|
||||
On macOS using [MacPorts][2] package manager (Tool is called ```pip-2.7``` here):
|
||||
|
||||
```bash
|
||||
sudo port install py27-pip
|
||||
```
|
||||
|
||||
#### Homebrew Package Manager
|
||||
|
||||
With the [Homebrew][3] package manager (```pip``` is included in the ```python``` package):
|
||||
With the [Homebrew][3] package manager (```pip``` is included in the ```python3``` package):
|
||||
|
||||
```bash
|
||||
brew install python
|
||||
@ -76,13 +68,13 @@ python get-pip.py
|
||||
|
||||
#### Windows with Visual Studio
|
||||
|
||||
- Install the latest native Windows Python 2.7.x from [python.org][6]
|
||||
- Install the latest native Windows Python >= 3.4 from [python.org][6]
|
||||
- There is a special Edition for Visual Studio available that allows
|
||||
to compile Python 2.7 modules: Install [VCPython2.7][5]
|
||||
to compile Python 3.x modules: Install [VCpython3][5]
|
||||
- Open the Command Shell of the Compiler and run
|
||||
|
||||
```bash
|
||||
cd C:\Python27\Scripts
|
||||
cd C:\Python3x\Scripts
|
||||
pip install amitools
|
||||
```
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
from __future__ import print_function
|
||||
|
||||
from elf.BinFmtELF import BinFmtELF
|
||||
from hunk.BinFmtHunk import BinFmtHunk
|
||||
|
||||
from .elf.BinFmtELF import BinFmtELF
|
||||
from .hunk.BinFmtHunk import BinFmtHunk
|
||||
|
||||
class BinFmt:
|
||||
def __init__(self):
|
||||
|
||||
@ -180,7 +180,7 @@ class Segment:
|
||||
self.relocs[to_seg] = relocs
|
||||
|
||||
def get_reloc_to_segs(self):
|
||||
keys = self.relocs.keys()
|
||||
keys = list(self.relocs.keys())
|
||||
return sorted(keys, key=lambda x: x.id)
|
||||
|
||||
def get_reloc(self, to_seg):
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
from amitools.util.DisAsm import DisAsm
|
||||
from BinImage import *
|
||||
from .BinImage import *
|
||||
|
||||
class Disassemble:
|
||||
"""allows to disassemble code segments of a BinImage"""
|
||||
@ -45,7 +45,7 @@ class Disassemble:
|
||||
result.append(line)
|
||||
|
||||
# create final line
|
||||
line = "%08x\t%-20s\t%-30s " % (addr," ".join(map(lambda x: "%04x" %x, word)),code)
|
||||
line = "%08x\t%-20s\t%-30s " % (addr," ".join(["%04x" %x for x in word]),code)
|
||||
|
||||
# create line info
|
||||
size = len(word) * 2
|
||||
@ -63,7 +63,7 @@ class Disassemble:
|
||||
# mini test
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
from BinFmt import BinFmt
|
||||
from .BinFmt import BinFmt
|
||||
bf = BinFmt()
|
||||
for a in sys.argv[1:]:
|
||||
bi = bf.load_image(a)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
from __future__ import print_function
|
||||
from BinImage import *
|
||||
|
||||
from .BinImage import *
|
||||
import amitools.util.HexDump as HexDump
|
||||
|
||||
class Dumper:
|
||||
@ -49,7 +49,7 @@ class Dumper:
|
||||
# mini test
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
from BinFmt import BinFmt
|
||||
from .BinFmt import BinFmt
|
||||
bf = BinFmt()
|
||||
for a in sys.argv[1:]:
|
||||
bi = bf.load_image(a)
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
from __future__ import print_function
|
||||
|
||||
import struct
|
||||
|
||||
class Relocate:
|
||||
@ -104,7 +104,7 @@ class Relocate:
|
||||
# mini test
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
from BinFmt import BinFmt
|
||||
from .BinFmt import BinFmt
|
||||
bf = BinFmt()
|
||||
for a in sys.argv[1:]:
|
||||
bi = bf.load_image(a)
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
from __future__ import print_function
|
||||
|
||||
|
||||
from amitools.binfmt.BinImage import *
|
||||
from ELFFile import *
|
||||
from ELF import *
|
||||
from ELFReader import ELFReader
|
||||
from DwarfDebugLine import DwarfDebugLine
|
||||
from .ELFFile import *
|
||||
from .ELF import *
|
||||
from .ELFReader import ELFReader
|
||||
from .DwarfDebugLine import DwarfDebugLine
|
||||
|
||||
|
||||
class BinFmtELF:
|
||||
@ -66,14 +66,14 @@ class BinFmtELF:
|
||||
seg_type = None
|
||||
name = sect.name_str
|
||||
flags = 0
|
||||
if name == '.text':
|
||||
if name == b'.text':
|
||||
seg_type = SEGMENT_TYPE_CODE
|
||||
elif name == '.data':
|
||||
elif name == b'.data':
|
||||
seg_type = SEGMENT_TYPE_DATA
|
||||
elif name == '.rodata':
|
||||
elif name == b'.rodata':
|
||||
seg_type = SEGMENT_TYPE_DATA
|
||||
flags = SEGMENT_FLAG_READ_ONLY
|
||||
elif name == '.bss':
|
||||
elif name == b'.bss':
|
||||
seg_type = SEGMENT_TYPE_BSS
|
||||
# we got a segment
|
||||
if seg_type is not None:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
from __future__ import print_function
|
||||
import StringIO
|
||||
|
||||
import io
|
||||
import struct
|
||||
|
||||
class LineState:
|
||||
@ -52,7 +52,7 @@ class DwarfDebugLine:
|
||||
# get (optional) relocations
|
||||
rela = elf_file.get_section_by_name(".rela.debug_line")
|
||||
# start parsing
|
||||
self.input = StringIO.StringIO(debug_line.data)
|
||||
self.input = io.StringIO(debug_line.data)
|
||||
# decode header
|
||||
if not self.decode_header():
|
||||
return False
|
||||
@ -308,7 +308,7 @@ class DwarfDebugLine:
|
||||
# mini test
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
from ELFReader import ELFReader
|
||||
from .ELFReader import ELFReader
|
||||
reader = ELFReader()
|
||||
for a in sys.argv[1:]:
|
||||
f = open(a, "rb")
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
from ELF import *
|
||||
from .ELF import *
|
||||
|
||||
class ELFDumper:
|
||||
|
||||
@ -13,14 +13,14 @@ class ELFDumper:
|
||||
sym_txt = "%s (%d) + %d" % (rel_symbol.name_str, rel_symbol.idx, rel.addend)
|
||||
else:
|
||||
sym_txt = ""
|
||||
print "%s%08x %-10s %-20s %s" % (prefix, rel.offset, rel.type_str, sect_txt, sym_txt)
|
||||
print("%s%08x %-10s %-20s %s" % (prefix, rel.offset, rel.type_str, sect_txt, sym_txt))
|
||||
|
||||
def _dump_symbol(self, sym):
|
||||
print "\t\t\t%08x %6d %-8s %-8s %-16s" % (sym.value, sym.size, sym.type_str, sym.bind_str, sym.name_str)
|
||||
print("\t\t\t%08x %6d %-8s %-8s %-16s" % (sym.value, sym.size, sym.type_str, sym.bind_str, sym.name_str))
|
||||
|
||||
def dump_sections(self, show_relocs=False, show_debug=False):
|
||||
print "ELF Sections"
|
||||
print "id name size rela syms type flags"
|
||||
print("ELF Sections")
|
||||
print("id name size rela syms type flags")
|
||||
for sect in self.elf.sections:
|
||||
|
||||
# determine number of relocations
|
||||
@ -31,69 +31,69 @@ class ELFDumper:
|
||||
symbols = sect.get_symbols()
|
||||
num_syms = len(symbols)
|
||||
|
||||
print "%2d %-16s %08x %4d %4d %-10s %s" % \
|
||||
print("%2d %-16s %08x %4d %4d %-10s %s" % \
|
||||
(sect.idx, sect.name_str, sect.header.size, num_rela, num_syms,
|
||||
sect.header.type_str, ",".join(sect.header.flags_dec))
|
||||
sect.header.type_str, ",".join(sect.header.flags_dec)))
|
||||
|
||||
# show relas
|
||||
if show_relocs and num_rela > 0:
|
||||
print "\t\tRelocations:"
|
||||
print("\t\tRelocations:")
|
||||
for rel in rela:
|
||||
self._dump_rela_entry(rel)
|
||||
|
||||
# per segment relocations
|
||||
for tgt_sect in sect.get_rela_sections():
|
||||
print "\t\tTo Section #%d:" % tgt_sect.idx
|
||||
print("\t\tTo Section #%d:" % tgt_sect.idx)
|
||||
for rel in sect.get_rela_by_section(tgt_sect):
|
||||
self._dump_rela_entry(rel)
|
||||
|
||||
# show symbols
|
||||
if show_debug and num_syms > 0:
|
||||
print "\t\tSymbols:"
|
||||
print("\t\tSymbols:")
|
||||
for sym in symbols:
|
||||
self._dump_symbol(sym)
|
||||
|
||||
def dump_symbols(self):
|
||||
print "ELF Symbol Table"
|
||||
print("ELF Symbol Table")
|
||||
symtabs = self.elf.symtabs
|
||||
if len(symtabs) == 0:
|
||||
print "no symbols"
|
||||
print("no symbols")
|
||||
return
|
||||
|
||||
print "idx value size type bind visible ndx name"
|
||||
print("idx value size type bind visible ndx name")
|
||||
for symtab in symtabs:
|
||||
for sym in symtab.get_table_symbols():
|
||||
txt = sym.shndx_str
|
||||
if txt is None:
|
||||
txt =sym.section.name_str
|
||||
print "%4d %08x %6d %-8s %-8s %-8s %-16s %s" % \
|
||||
print("%4d %08x %6d %-8s %-8s %-8s %-16s %s" % \
|
||||
(sym.idx, sym.value, sym.size, sym.type_str,
|
||||
sym.bind_str, sym.visibility_str,
|
||||
txt, sym.name_str)
|
||||
txt, sym.name_str))
|
||||
|
||||
def dump_relas(self):
|
||||
print "ELF Relocations"
|
||||
print("ELF Relocations")
|
||||
rela_sects = self.elf.relas
|
||||
if len(rela_sects) == 0:
|
||||
print "no relocations"
|
||||
print("no relocations")
|
||||
return
|
||||
|
||||
for rela_sect in rela_sects:
|
||||
print rela_sect.name_str, "linked to", rela_sect.reloc_section.name_str
|
||||
print " offset type segment + addend symbol + addend"
|
||||
print(rela_sect.name_str, "linked to", rela_sect.reloc_section.name_str)
|
||||
print(" offset type segment + addend symbol + addend")
|
||||
num = 0
|
||||
for rela in rela_sect.get_relocations():
|
||||
self._dump_rela_entry(rela, prefix="%4d " % num)
|
||||
num += 1
|
||||
|
||||
def dump_relas_by_sect(self):
|
||||
print "ELF Relocations (by sections)"
|
||||
print("ELF Relocations (by sections)")
|
||||
for sect in self.elf.sections:
|
||||
to_sects = sect.get_rela_sections()
|
||||
if len(to_sects) > 0:
|
||||
print " section", sect.idx
|
||||
print(" section", sect.idx)
|
||||
for to_sect in to_sects:
|
||||
print " -> section", to_sect.idx
|
||||
print(" -> section", to_sect.idx)
|
||||
num = 0
|
||||
for rela in sect.get_rela_by_section(to_sect):
|
||||
self._dump_rela_entry(rela, prefix=" %4d " % num)
|
||||
@ -101,7 +101,7 @@ class ELFDumper:
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
from ELFReader import ELFReader
|
||||
from .ELFReader import ELFReader
|
||||
import sys
|
||||
reader = ELFReader()
|
||||
for a in sys.argv[1:]:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import struct
|
||||
from ELF import *
|
||||
from .ELF import *
|
||||
|
||||
|
||||
class ELFParseError(Exception):
|
||||
@ -23,7 +23,7 @@ class ELFPart:
|
||||
decoded = struct.unpack(">"+fmt, data)
|
||||
if len(decoded) != nlen:
|
||||
raise ELFParseError("data decode error")
|
||||
for i in xrange(nlen):
|
||||
for i in range(nlen):
|
||||
setattr(self, self._names[i], decoded[i])
|
||||
|
||||
def _decode_flags(self, value, names):
|
||||
@ -34,7 +34,7 @@ class ELFPart:
|
||||
return result
|
||||
|
||||
def _decode_value(self, value, names):
|
||||
if names.has_key(value):
|
||||
if value in names:
|
||||
return names[value]
|
||||
else:
|
||||
return None
|
||||
@ -49,13 +49,13 @@ class ELFIdentifier(ELFPart):
|
||||
def parse(self, ident_data):
|
||||
# magic
|
||||
magic = ident_data[0:4]
|
||||
if magic != "\177ELF":
|
||||
if magic != b"\177ELF":
|
||||
raise ELFParseError("No ELF Magic found!")
|
||||
self.class_ = ord(ident_data[4])
|
||||
self.data = ord(ident_data[5])
|
||||
self.version = ord(ident_data[6])
|
||||
self.osabi = ord(ident_data[7])
|
||||
self.abiversion = ord(ident_data[8])
|
||||
self.class_ = ident_data[4]
|
||||
self.data = ident_data[5]
|
||||
self.version = ident_data[6]
|
||||
self.osabi = ident_data[7]
|
||||
self.abiversion = ident_data[8]
|
||||
|
||||
|
||||
class ELFHeader(ELFPart):
|
||||
@ -104,13 +104,13 @@ class ELFSection:
|
||||
|
||||
def get_rela_by_section(self, sect):
|
||||
"""return a list of relocations from the given section"""
|
||||
if self.reloc_by_sect.has_key(sect):
|
||||
if sect in self.reloc_by_sect:
|
||||
return self.reloc_by_sect[sect]
|
||||
else:
|
||||
return []
|
||||
|
||||
def get_rela_sections(self):
|
||||
return sorted(self.reloc_by_sect.keys(), key=lambda x : x.idx)
|
||||
return sorted(list(self.reloc_by_sect.keys()), key=lambda x : x.idx)
|
||||
|
||||
def get_symbols(self):
|
||||
return self.symbols
|
||||
@ -132,7 +132,7 @@ class ELFSectionStringTable(ELFSectionWithData):
|
||||
o = 0
|
||||
strtab = []
|
||||
while o < l:
|
||||
n = self.data.find('\0',o)
|
||||
n = self.data.find(b'\0',o)
|
||||
if n == -1:
|
||||
raise ELFParseError("Invalid strtab!")
|
||||
if n > 0:
|
||||
@ -188,12 +188,12 @@ class ELFSectionSymbolTable(ELFSectionWithData):
|
||||
|
||||
def decode(self):
|
||||
entsize = self.header.entsize
|
||||
num = self.header.size / entsize
|
||||
num = self.header.size // entsize
|
||||
symtab = []
|
||||
self.symtab = symtab
|
||||
off = 0
|
||||
idx = 0
|
||||
for n in xrange(num):
|
||||
for n in range(num):
|
||||
entry = ELFSymbol(idx)
|
||||
entry_data = self.data[off:off+entsize]
|
||||
entry.parse(entry_data)
|
||||
@ -237,11 +237,11 @@ class ELFSectionRelocationsWithAddend(ELFSectionWithData):
|
||||
|
||||
def decode(self):
|
||||
entsize = self.header.entsize
|
||||
num = self.header.size / entsize
|
||||
num = self.header.size // entsize
|
||||
rela = []
|
||||
self.rela = rela
|
||||
off = 0
|
||||
for n in xrange(num):
|
||||
for n in range(num):
|
||||
entry = ELFRelocationWithAddend()
|
||||
entry_data = self.data[off:off+entsize]
|
||||
entry.parse(entry_data)
|
||||
|
||||
@ -2,8 +2,8 @@
|
||||
|
||||
import struct
|
||||
import os
|
||||
from ELF import *
|
||||
from ELFFile import *
|
||||
from .ELF import *
|
||||
from .ELFFile import *
|
||||
|
||||
|
||||
class ELFReader:
|
||||
@ -13,7 +13,7 @@ class ELFReader:
|
||||
shentsize = ef.header.shentsize
|
||||
f.seek(shoff, os.SEEK_SET)
|
||||
shnum = ef.header.shnum
|
||||
for i in xrange(shnum):
|
||||
for i in range(shnum):
|
||||
sh = ELFSectionHeader()
|
||||
sh_data = f.read(shentsize)
|
||||
sh.parse(sh_data)
|
||||
@ -141,7 +141,7 @@ class ELFReader:
|
||||
|
||||
# add entry to section list
|
||||
tgt_sect = entry.section
|
||||
if by_sect.has_key(tgt_sect):
|
||||
if tgt_sect in by_sect:
|
||||
by_sect_list = by_sect[tgt_sect]
|
||||
else:
|
||||
by_sect_list = []
|
||||
|
||||
@ -1,2 +1,2 @@
|
||||
from ELFDumper import ELFDumper
|
||||
from ELFReader import ELFReader
|
||||
from .ELFDumper import ELFDumper
|
||||
from .ELFReader import ELFReader
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
from __future__ import print_function
|
||||
|
||||
|
||||
from amitools.binfmt.BinImage import *
|
||||
from HunkBlockFile import HunkBlockFile, HunkParseError
|
||||
from HunkLoadSegFile import HunkLoadSegFile, HunkSegment
|
||||
from HunkDebug import *
|
||||
import Hunk
|
||||
from .HunkBlockFile import HunkBlockFile, HunkParseError
|
||||
from .HunkLoadSegFile import HunkLoadSegFile, HunkSegment
|
||||
from .HunkDebug import *
|
||||
from . import Hunk
|
||||
|
||||
class BinFmtHunk:
|
||||
"""Handle Amiga's native Hunk file format"""
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
"""The hunk block types defined as data classes"""
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
|
||||
import struct
|
||||
from Hunk import *
|
||||
from .Hunk import *
|
||||
|
||||
|
||||
class HunkParseError(Exception):
|
||||
@ -49,7 +49,7 @@ class HunkBlock:
|
||||
data = f.read(size)
|
||||
if len(data) < size:
|
||||
return -1,None
|
||||
endpos = data.find('\0')
|
||||
endpos = data.find(b'\0')
|
||||
if endpos == -1:
|
||||
return size,data
|
||||
elif endpos == 0:
|
||||
@ -118,7 +118,7 @@ class HunkHeaderBlock(HunkBlock):
|
||||
|
||||
# determine number of hunks in size table
|
||||
num_hunks = self.last_hunk - self.first_hunk + 1
|
||||
for a in xrange(num_hunks):
|
||||
for a in range(num_hunks):
|
||||
hunk_size = self._read_long(f)
|
||||
if hunk_size < 0:
|
||||
raise HunkParseError("HUNK_HEADER contains invalid hunk_size")
|
||||
@ -178,7 +178,7 @@ class HunkRelocLongBlock(HunkBlock):
|
||||
break
|
||||
hunk_num = self._read_long(f)
|
||||
offsets = []
|
||||
for i in xrange(num):
|
||||
for i in range(num):
|
||||
off = self._read_long(f)
|
||||
offsets.append(off)
|
||||
self.relocs.append((hunk_num, offsets))
|
||||
@ -214,7 +214,7 @@ class HunkRelocWordBlock(HunkBlock):
|
||||
hunk_num = self._read_word(f)
|
||||
num_words += num_offs + 1
|
||||
offsets = []
|
||||
for i in xrange(num_offs):
|
||||
for i in range(num_offs):
|
||||
off = self._read_word(f)
|
||||
offsets.append(off)
|
||||
self.relocs.append((hunk_num, offsets))
|
||||
@ -228,7 +228,7 @@ class HunkRelocWordBlock(HunkBlock):
|
||||
num_offs = len(offsets)
|
||||
self._write_word(f, num_offs)
|
||||
self._write_word(f, hunk_num)
|
||||
for i in xrange(num_offs):
|
||||
for i in range(num_offs):
|
||||
self._write_word(f, offsets[i])
|
||||
num_words += 2 + num_offs
|
||||
# end
|
||||
@ -382,7 +382,7 @@ class HunkExtBlock(HunkBlock):
|
||||
elif ext_type >= 0x80:
|
||||
num_refs = self._read_long(f)
|
||||
offsets = []
|
||||
for i in xrange(num_refs):
|
||||
for i in range(num_refs):
|
||||
off = self._read_long(f)
|
||||
offsets.append(off)
|
||||
# is a definition
|
||||
@ -523,7 +523,7 @@ class HunkIndexBlock(HunkBlock):
|
||||
num_words -= 3
|
||||
unit_entry = HunkIndexUnitEntry(name_off, first_hunk_long_off)
|
||||
self.units.append(unit_entry)
|
||||
for i in xrange(num_hunks):
|
||||
for i in range(num_hunks):
|
||||
# hunk description
|
||||
name_off = self._read_word(f)
|
||||
hunk_longs = self._read_word(f)
|
||||
@ -532,12 +532,12 @@ class HunkIndexBlock(HunkBlock):
|
||||
unit_entry.index_hunks.append(hunk_entry)
|
||||
# refs
|
||||
num_refs = self._read_word(f)
|
||||
for j in xrange(num_refs):
|
||||
for j in range(num_refs):
|
||||
name_off = self._read_word(f)
|
||||
hunk_entry.sym_refs.append(HunkIndexSymbolRef(name_off))
|
||||
# defs
|
||||
num_defs = self._read_word(f)
|
||||
for j in xrange(num_defs):
|
||||
for j in range(num_defs):
|
||||
name_off = self._read_word(f)
|
||||
value = self._read_word(f)
|
||||
stype = self._read_word(f)
|
||||
@ -735,20 +735,20 @@ class HunkBlockFile:
|
||||
# mini test
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
import StringIO
|
||||
import io
|
||||
for a in sys.argv[1:]:
|
||||
# read data
|
||||
f = open(a, "rb")
|
||||
data = f.read()
|
||||
f.close()
|
||||
# parse from string stream
|
||||
fobj = StringIO.StringIO(data)
|
||||
fobj = io.StringIO(data)
|
||||
hbf = HunkBlockFile()
|
||||
hbf.read(fobj, True)
|
||||
fobj.close()
|
||||
print(hbf.blocks)
|
||||
# write to new string stream
|
||||
nobj = StringIO.StringIO()
|
||||
nobj = io.StringIO()
|
||||
hbf.write(nobj, True)
|
||||
new_data = nobj.getvalue()
|
||||
nobj.close()
|
||||
@ -760,7 +760,7 @@ if __name__ == '__main__':
|
||||
if len(data) != len(new_data):
|
||||
print("MISMATCH", len(data), len(new_data))
|
||||
else:
|
||||
for i in xrange(len(data)):
|
||||
for i in range(len(data)):
|
||||
if data[i] != new_data[i]:
|
||||
print("MISMATCH @%x" % i)
|
||||
print("OK")
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
from __future__ import print_function
|
||||
|
||||
import struct
|
||||
import StringIO
|
||||
import io
|
||||
|
||||
|
||||
class HunkDebugLineEntry:
|
||||
@ -56,7 +56,7 @@ class HunkDebugAny:
|
||||
class HunkDebug:
|
||||
def encode(self, debug_info):
|
||||
"""encode a debug info and return a debug_data chunk"""
|
||||
out = StringIO.StringIO()
|
||||
out = io.StringIO()
|
||||
# +0: base offset
|
||||
self._write_long(out, debug_info.base_offset)
|
||||
# +4: type tag
|
||||
@ -140,7 +140,7 @@ class HunkDebug:
|
||||
# ----- mini test -----
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
from HunkBlockFile import HunkBlockFile, HunkDebugBlock
|
||||
from .HunkBlockFile import HunkBlockFile, HunkDebugBlock
|
||||
hd = HunkDebug()
|
||||
for a in sys.argv[1:]:
|
||||
hbf = HunkBlockFile()
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
from amitools.util.DisAsm import DisAsm
|
||||
import Hunk
|
||||
from . import Hunk
|
||||
|
||||
class HunkDisassembler:
|
||||
|
||||
@ -74,7 +74,7 @@ class HunkDisassembler:
|
||||
def find_reloc(self, hunk, addr, word):
|
||||
end_addr = addr + len(word) * 2
|
||||
for h in hunk[1:]:
|
||||
valid = self.map_reloc_to_num_words.has_key(h['type'])
|
||||
valid = h['type'] in self.map_reloc_to_num_words
|
||||
if valid:
|
||||
num_words = self.map_reloc_to_num_words[h['type']]
|
||||
reloc = h['reloc']
|
||||
@ -86,7 +86,7 @@ class HunkDisassembler:
|
||||
|
||||
# calc offset
|
||||
addr = 0
|
||||
for i in xrange(num_words):
|
||||
for i in range(num_words):
|
||||
addr = addr * 0x10000 + word[word_offset+i]
|
||||
|
||||
reloc_type_name = h['type_name'].replace("HUNK_","").lower()
|
||||
@ -111,7 +111,7 @@ class HunkDisassembler:
|
||||
if h['type'] == Hunk.HUNK_EXT:
|
||||
for ext in h['ext_ref']:
|
||||
refs = ext['refs']
|
||||
valid = self.map_ext_ref_to_num_words.has_key(ext['type'])
|
||||
valid = ext['type'] in self.map_ext_ref_to_num_words
|
||||
if valid:
|
||||
num_words = self.map_ext_ref_to_num_words[ext['type']]
|
||||
for ref in refs:
|
||||
@ -133,9 +133,9 @@ class HunkDisassembler:
|
||||
# search the index of a lib for a definition
|
||||
def find_index_def(self, hunk, addr):
|
||||
main = hunk[0]
|
||||
if main.has_key('index_hunk'):
|
||||
if 'index_hunk' in main:
|
||||
info = main['index_hunk']
|
||||
if info.has_key('defs'):
|
||||
if 'defs' in info:
|
||||
for d in info['defs']:
|
||||
if d['value'] == addr:
|
||||
return d['name']
|
||||
@ -203,7 +203,7 @@ class HunkDisassembler:
|
||||
|
||||
# create final line
|
||||
if symbol != None:
|
||||
print "\t\t\t\t%s:" % symbol
|
||||
print "%08x\t%-20s\t%-30s %s" % (addr," ".join(map(lambda x: "%04x" %x, word)),code,comment)
|
||||
print("\t\t\t\t%s:" % symbol)
|
||||
print("%08x\t%-20s\t%-30s %s" % (addr," ".join(["%04x" %x for x in word]),code,comment))
|
||||
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
from __future__ import print_function
|
||||
from __future__ import print_function
|
||||
|
||||
from HunkBlockFile import *
|
||||
from HunkDebug import HunkDebug
|
||||
|
||||
|
||||
from .HunkBlockFile import *
|
||||
from .HunkDebug import HunkDebug
|
||||
|
||||
|
||||
class HunkSegment:
|
||||
@ -227,7 +227,7 @@ class HunkLoadSegFile:
|
||||
self.segments.append(seg)
|
||||
# set size in segments
|
||||
n = len(second)
|
||||
for i in xrange(n):
|
||||
for i in range(n):
|
||||
self.segments[i].size_longs = hdr_blk.hunk_table[i]
|
||||
self.segments[i].size = self.segments[i].size_longs * 4
|
||||
|
||||
@ -269,7 +269,7 @@ if __name__ == '__main__':
|
||||
if len(data) != len(new_data):
|
||||
print("MISMATCH", len(data), len(new_data))
|
||||
else:
|
||||
for i in xrange(len(data)):
|
||||
for i in range(len(data)):
|
||||
if data[i] != new_data[i]:
|
||||
print("MISMATCH @%x" % i)
|
||||
print("OK")
|
||||
|
||||
@ -2,9 +2,9 @@
|
||||
|
||||
import os
|
||||
import struct
|
||||
import StringIO
|
||||
import io
|
||||
from types import *
|
||||
from Hunk import *
|
||||
from .Hunk import *
|
||||
|
||||
class HunkReader:
|
||||
"""Load Amiga executable Hunk structures"""
|
||||
@ -30,12 +30,12 @@ class HunkReader:
|
||||
result.append(v)
|
||||
return "[" + ",".join(result) + "]"
|
||||
elif type(obj) == DictType:
|
||||
if obj.has_key('type_name'):
|
||||
if 'type_name' in obj:
|
||||
type_name = obj['type_name']
|
||||
return type_name.replace('HUNK_','')
|
||||
else:
|
||||
result = []
|
||||
for k in obj.keys():
|
||||
for k in list(obj.keys()):
|
||||
v = self.get_struct_summary(obj[k])
|
||||
if v != None:
|
||||
result.append(k + ":" + v)
|
||||
@ -129,7 +129,7 @@ class HunkReader:
|
||||
# determine number of hunks in size table
|
||||
num_hunks = last_hunk - first_hunk + 1
|
||||
hunk_table = []
|
||||
for a in xrange(num_hunks):
|
||||
for a in range(num_hunks):
|
||||
hunk_info = {}
|
||||
hunk_size = self.read_long(f)
|
||||
if hunk_size < 0:
|
||||
@ -194,7 +194,7 @@ class HunkReader:
|
||||
return RESULT_INVALID_HUNK_FILE
|
||||
|
||||
offsets = []
|
||||
for a in xrange(num_relocs & 0xffff):
|
||||
for a in range(num_relocs & 0xffff):
|
||||
offset = self.read_long(f)
|
||||
if offset < 0:
|
||||
self.error_string = "%s has invalid relocation #%d offset %d (num_relocs=%d hunk_num=%d, offset=%d)" \
|
||||
@ -228,7 +228,7 @@ class HunkReader:
|
||||
offsets = []
|
||||
count = num_relocs & 0xffff
|
||||
total_words += count + 2
|
||||
for a in xrange(count):
|
||||
for a in range(count):
|
||||
offset = self.read_word(f)
|
||||
if offset < 0:
|
||||
self.error_string = "%s has invalid relocation #%d offset %d (num_relocs=%d hunk_num=%d, offset=%d)" \
|
||||
@ -380,7 +380,7 @@ class HunkReader:
|
||||
# for all hunks in unit
|
||||
ihunks = []
|
||||
unit['hunk_infos'] = ihunks
|
||||
for a in xrange(num_hunks):
|
||||
for a in range(num_hunks):
|
||||
ihunk = {}
|
||||
ihunks.append(ihunk)
|
||||
|
||||
@ -401,7 +401,7 @@ class HunkReader:
|
||||
if num_refs > 0:
|
||||
refs = []
|
||||
ihunk['refs'] = refs
|
||||
for b in xrange(num_refs):
|
||||
for b in range(num_refs):
|
||||
ref = {}
|
||||
name_offset = self.read_word(f)
|
||||
total_size -= 2
|
||||
@ -421,7 +421,7 @@ class HunkReader:
|
||||
if num_defs > 0:
|
||||
defs = []
|
||||
ihunk['defs'] = defs
|
||||
for b in xrange(num_defs):
|
||||
for b in range(num_defs):
|
||||
name_offset = self.read_word(f)
|
||||
def_value = self.read_word(f)
|
||||
def_type_flags = self.read_word(f)
|
||||
@ -470,7 +470,7 @@ class HunkReader:
|
||||
ext = { 'type' : ext_type, 'name' : ext_name }
|
||||
|
||||
# check and setup type name
|
||||
if not ext_names.has_key(ext_type):
|
||||
if ext_type not in ext_names:
|
||||
self.error_string = "%s has unspported ext entry %d" % (hunk['type_name'],ext_type)
|
||||
return RESULT_INVALID_HUNK_FILE
|
||||
ext['type_name'] = ext_names[ext_type]
|
||||
@ -489,7 +489,7 @@ class HunkReader:
|
||||
if num_refs == 0:
|
||||
num_refs = 1
|
||||
refs = []
|
||||
for a in xrange(num_refs):
|
||||
for a in range(num_refs):
|
||||
ref = self.read_long(f)
|
||||
refs.append(ref)
|
||||
ext['refs'] = refs
|
||||
@ -528,7 +528,7 @@ class HunkReader:
|
||||
|
||||
"""Read a hunk from memory"""
|
||||
def read_mem(self, name, data):
|
||||
fobj = StringIO.StringIO(data)
|
||||
fobj = io.StringIO(data)
|
||||
return self.read_file_obj(name, fobj)
|
||||
|
||||
def read_file_obj(self, hfile, f):
|
||||
@ -565,7 +565,7 @@ class HunkReader:
|
||||
hunk_flags = hunk_raw_type & HUNK_FLAGS_MASK
|
||||
|
||||
# check range of hunk type
|
||||
if not hunk_names.has_key(hunk_type):
|
||||
if hunk_type not in hunk_names:
|
||||
# no hunk file?
|
||||
if is_first_hunk:
|
||||
self.error_string = "No hunk file: '%s' type was %d" % (hfile, hunk_type)
|
||||
@ -913,7 +913,7 @@ class HunkReader:
|
||||
if lib_off == hunk_offset:
|
||||
# found segment
|
||||
num_segs = len(unit['hunk_infos'])
|
||||
for i in xrange(num_segs):
|
||||
for i in range(num_segs):
|
||||
info = unit['hunk_infos'][i]
|
||||
seg = segment_list[hunk_no+i]
|
||||
unit_segments.append(seg)
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import ctypes
|
||||
import struct
|
||||
import Hunk
|
||||
from . import Hunk
|
||||
|
||||
class HunkRelocate:
|
||||
|
||||
@ -52,11 +52,11 @@ class HunkRelocate:
|
||||
data = ctypes.create_string_buffer(alloc_size)
|
||||
|
||||
# fill in segment data
|
||||
if main_hunk.has_key('data'):
|
||||
if 'data' in main_hunk:
|
||||
data.value = main_hunk['data']
|
||||
|
||||
if self.verbose:
|
||||
print "#%02d @ %06x" % (hunk_no, addr[hunk_no])
|
||||
print("#%02d @ %06x" % (hunk_no, addr[hunk_no]))
|
||||
|
||||
# find relocation hunks
|
||||
for hunk in segment[1:]:
|
||||
@ -79,7 +79,7 @@ class HunkRelocate:
|
||||
addr = hunk_addr + delta
|
||||
self.write_long(data, offset, addr)
|
||||
if self.verbose:
|
||||
print "#%02d + %06x: %06x (delta) + %06x (hunk_addr) -> %06x" % (hunk_no, offset, delta, hunk_addr, addr)
|
||||
print("#%02d + %06x: %06x (delta) + %06x (hunk_addr) -> %06x" % (hunk_no, offset, delta, hunk_addr, addr))
|
||||
|
||||
def read_long(self, data, offset):
|
||||
bytes = data[offset:offset+4]
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import Hunk
|
||||
import HunkDisassembler
|
||||
from . import Hunk
|
||||
from . import HunkDisassembler
|
||||
from amitools.util.HexDump import *
|
||||
|
||||
class HunkShow:
|
||||
@ -38,7 +38,7 @@ class HunkShow:
|
||||
|
||||
def show_lib_segments(self):
|
||||
for lib in self.libs:
|
||||
print "Library #%d" % lib['lib_no']
|
||||
print("Library #%d" % lib['lib_no'])
|
||||
for unit in lib['units']:
|
||||
self.print_unit(unit['unit_no'], unit['name'])
|
||||
for segment in unit['segments']:
|
||||
@ -59,9 +59,9 @@ class HunkShow:
|
||||
|
||||
# overlay
|
||||
if self.overlay != None:
|
||||
print "Overlay"
|
||||
print("Overlay")
|
||||
num_ov = len(self.overlay_headers)
|
||||
for o in xrange(num_ov):
|
||||
for o in range(num_ov):
|
||||
if not self.brief:
|
||||
self.print_header(self.overlay_headers[o])
|
||||
for segment in self.overlay_segments[o]:
|
||||
@ -72,18 +72,18 @@ class HunkShow:
|
||||
|
||||
# unit hunks are named
|
||||
name = ""
|
||||
if hunk[0].has_key('name'):
|
||||
if 'name' in hunk[0]:
|
||||
name = "'%s'" % main['name']
|
||||
|
||||
type_name = main['type_name'].replace("HUNK_","")
|
||||
size = main['size']
|
||||
hunk_no = main['hunk_no']
|
||||
if main.has_key('data_file_offset'):
|
||||
if 'data_file_offset' in main:
|
||||
data_file_offset = main['data_file_offset']
|
||||
else:
|
||||
data_file_offset = None
|
||||
hunk_file_offset = main['hunk_file_offset']
|
||||
if main.has_key('alloc_size'):
|
||||
if 'alloc_size' in main:
|
||||
alloc_size = main['alloc_size']
|
||||
else:
|
||||
alloc_size = None
|
||||
@ -96,24 +96,24 @@ class HunkShow:
|
||||
self.show_extra_hunk(extra)
|
||||
|
||||
# index hunk info is embedded if its in a lib
|
||||
if main.has_key('index_hunk'):
|
||||
if 'index_hunk' in main:
|
||||
self.show_index_info(main['index_hunk'])
|
||||
|
||||
if main['type'] == Hunk.HUNK_CODE and self.disassemble and len(main['data'])>0:
|
||||
disas = HunkDisassembler.HunkDisassembler(use_objdump = self.use_objdump, cpu = self.cpu)
|
||||
print
|
||||
print()
|
||||
disas.show_disassembly(hunk, seg_list, self.disassemble_start)
|
||||
print
|
||||
print()
|
||||
|
||||
def show_index_info(self, info):
|
||||
# references from index
|
||||
if info.has_key('refs'):
|
||||
if 'refs' in info:
|
||||
self.print_extra("refs","#%d" % len(info['refs']))
|
||||
if not self.brief:
|
||||
for ref in info['refs']:
|
||||
self.print_symbol(-1,ref['name'],"(%d bits)" % ref['bits'])
|
||||
# defines from index
|
||||
if info.has_key('defs'):
|
||||
if 'defs' in info:
|
||||
self.print_extra("defs","#%d" % len(info['defs']))
|
||||
if not self.brief:
|
||||
for d in info['defs']:
|
||||
@ -192,13 +192,13 @@ class HunkShow:
|
||||
# ----- printing -----
|
||||
|
||||
def print_header(self, hdr):
|
||||
print "\t header (segments: first=%d, last=%d, table size=%d)" % (hdr['first_hunk'], hdr['last_hunk'], hdr['table_size'])
|
||||
print("\t header (segments: first=%d, last=%d, table size=%d)" % (hdr['first_hunk'], hdr['last_hunk'], hdr['table_size']))
|
||||
|
||||
def print_extra(self, type_name, info):
|
||||
print "\t\t%8s %s" % (type_name, info)
|
||||
print("\t\t%8s %s" % (type_name, info))
|
||||
|
||||
def print_extra_sub(self, text):
|
||||
print "\t\t\t%s" % text
|
||||
print("\t\t\t%s" % text)
|
||||
|
||||
def print_segment_header(self, hunk_no, type_name, size, name, data_file_offset, hunk_file_offset, alloc_size):
|
||||
extra = ""
|
||||
@ -207,17 +207,17 @@ class HunkShow:
|
||||
extra += "file header @%08x" % hunk_file_offset
|
||||
if data_file_offset != None:
|
||||
extra += " data @%08x" % data_file_offset
|
||||
print "\t#%03d %-5s size %08x %s %s" % (hunk_no, type_name, size, extra, name)
|
||||
print("\t#%03d %-5s size %08x %s %s" % (hunk_no, type_name, size, extra, name))
|
||||
|
||||
def print_symbol(self,addr,name,extra):
|
||||
if addr == -1:
|
||||
a = "xxxxxxxx"
|
||||
else:
|
||||
a = "%08x" % addr
|
||||
print "\t\t\t%s %-32s %s" % (a,name,extra)
|
||||
print("\t\t\t%s %-32s %s" % (a,name,extra))
|
||||
|
||||
def print_unit(self, no, name):
|
||||
print " #%03d UNIT %s" % (no, name)
|
||||
print(" #%03d UNIT %s" % (no, name))
|
||||
|
||||
|
||||
|
||||
|
||||
@ -86,7 +86,7 @@ def read_fd(fname):
|
||||
elif cmd == "end":
|
||||
break
|
||||
else:
|
||||
print "Invalid command:",cmda
|
||||
print("Invalid command:",cmda)
|
||||
return None
|
||||
# a function
|
||||
else:
|
||||
@ -107,8 +107,8 @@ def read_fd(fname):
|
||||
if len(arg) != len(reg):
|
||||
# hack for double reg args found in mathieeedoub* libs
|
||||
if len(arg) * 2 == len(reg):
|
||||
arg_hi = map(lambda x: x + "_hi", arg)
|
||||
arg_lo = map(lambda x: x + "_lo", arg)
|
||||
arg_hi = [x + "_hi" for x in arg]
|
||||
arg_lo = [x + "_lo" for x in arg]
|
||||
arg = [x for pair in zip(arg_hi, arg_lo) for x in pair]
|
||||
else:
|
||||
raise IOError("Reg and Arg name mismatch in FD File")
|
||||
@ -147,8 +147,8 @@ def write_fd(fname, fd, add_private):
|
||||
if args == None:
|
||||
line += "()()"
|
||||
else:
|
||||
line += "(" + ",".join(map(lambda x : x[0], args)) + ")"
|
||||
line += "(" + "/".join(map(lambda x : x[1], args)) + ")"
|
||||
line += "(" + ",".join([x[0] for x in args]) + ")"
|
||||
line += "(" + "/".join([x[1] for x in args]) + ")"
|
||||
fo.write("%s\n" % line)
|
||||
fo.write("##end\n")
|
||||
fo.close()
|
||||
|
||||
@ -3,7 +3,7 @@ class FuncDef:
|
||||
def __init__(self, name, bias, private=False, is_std=False):
|
||||
self.name = name
|
||||
self.bias = bias
|
||||
self.index = (bias - 6) / 6
|
||||
self.index = (bias - 6) // 6
|
||||
self.private = private
|
||||
self.std = is_std
|
||||
self.args = []
|
||||
@ -24,13 +24,13 @@ class FuncDef:
|
||||
def add_arg(self, name, reg):
|
||||
self.args.append((name, reg))
|
||||
def dump(self):
|
||||
print(self.name,self.bias,self.private,self.args)
|
||||
print((self.name,self.bias,self.private,self.args))
|
||||
def get_arg_str(self, with_reg=True):
|
||||
if len(self.args) == 0:
|
||||
return "()"
|
||||
elif with_reg:
|
||||
return "( " + ", ".join(map(lambda x : "%s/%s" % (x[0],x[1]), self.args)) + " )"
|
||||
return "( " + ", ".join(["%s/%s" % (x[0],x[1]) for x in self.args]) + " )"
|
||||
else:
|
||||
return "( " + ", ".join(map(lambda x : "%s" % x[0], self.args)) + " )"
|
||||
return "( " + ", ".join(["%s" % x[0] for x in self.args]) + " )"
|
||||
def get_str(self, with_reg=True):
|
||||
return self.name + self.get_arg_str(with_reg)
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
from FuncDef import FuncDef
|
||||
from .FuncDef import FuncDef
|
||||
|
||||
class FuncTable:
|
||||
"""Store a function table"""
|
||||
@ -30,10 +30,10 @@ class FuncTable:
|
||||
return self.max_bias + 6
|
||||
|
||||
def get_num_indices(self):
|
||||
return self.max_bias / 6
|
||||
return self.max_bias // 6
|
||||
|
||||
def get_all_func_names():
|
||||
return self.name_map.keys()
|
||||
return list(self.name_map.keys())
|
||||
|
||||
def has_func(self, name):
|
||||
return name in self.name_map
|
||||
@ -68,7 +68,7 @@ class FuncTable:
|
||||
if bias > self.max_bias:
|
||||
self.max_bias = bias
|
||||
# update index table
|
||||
tab_len = bias / 6
|
||||
tab_len = bias // 6
|
||||
while len(self.index_tab) < tab_len:
|
||||
self.index_tab.append(None)
|
||||
index = tab_len - 1
|
||||
@ -86,7 +86,7 @@ class FuncTable:
|
||||
func_def.add_arg(arg[i],reg[i])
|
||||
|
||||
def dump(self):
|
||||
print("FuncTable:",self.base_name)
|
||||
print(("FuncTable:",self.base_name))
|
||||
for f in self.funcs:
|
||||
f.dump()
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
from __future__ import absolute_import
|
||||
from __future__ import print_function
|
||||
|
||||
|
||||
|
||||
import struct
|
||||
import ctypes
|
||||
@ -39,7 +39,7 @@ class ADFSBitmap:
|
||||
def create(self):
|
||||
# create data and preset with 0xff
|
||||
self.bitmap_data = ctypes.create_string_buffer(self.bitmap_all_blk_bytes)
|
||||
for i in xrange(self.bitmap_all_blk_bytes):
|
||||
for i in range(self.bitmap_all_blk_bytes):
|
||||
self.bitmap_data[i] = chr(0xff)
|
||||
|
||||
# clear bit for root block
|
||||
@ -48,7 +48,7 @@ class ADFSBitmap:
|
||||
blk_pos += 1
|
||||
|
||||
# create ext blocks
|
||||
for i in xrange(self.num_ext):
|
||||
for i in range(self.num_ext):
|
||||
bm_ext = BitmapExtBlock(self.blkdev, blk_pos)
|
||||
bm_ext.create()
|
||||
self.clr_bit(blk_pos)
|
||||
@ -56,7 +56,7 @@ class ADFSBitmap:
|
||||
self.ext_blks.append(bm_ext)
|
||||
|
||||
# create bitmap blocks
|
||||
for i in xrange(self.bitmap_num_blks):
|
||||
for i in range(self.bitmap_num_blks):
|
||||
bm = BitmapBlock(self.blkdev, blk_pos)
|
||||
bm.create()
|
||||
self.clr_bit(blk_pos)
|
||||
@ -66,7 +66,7 @@ class ADFSBitmap:
|
||||
# set pointers to ext blocks
|
||||
if self.num_ext > 0:
|
||||
self.root_blk.bitmap_ext_blk = self.ext_blks[0].blk_num
|
||||
for i in xrange(self.num_ext-1):
|
||||
for i in range(self.num_ext-1):
|
||||
bm_ext = self.ext_blks[i]
|
||||
bm_ext_next = self.ext_blks[i+1]
|
||||
bm_ext.bitmap_ext_blk = bm_ext_next.blk_num
|
||||
@ -74,7 +74,7 @@ class ADFSBitmap:
|
||||
# set pointers to bitmap blocks
|
||||
cur_ext_index = 0
|
||||
cur_ext_pos = 0
|
||||
for i in xrange(self.bitmap_num_blks):
|
||||
for i in range(self.bitmap_num_blks):
|
||||
blk_num = self.bitmap_blks[i].blk_num
|
||||
if i < self.num_blks_in_root:
|
||||
# pointers in root block
|
||||
@ -189,7 +189,7 @@ class ADFSBitmap:
|
||||
if num == 1:
|
||||
return [first_blk]
|
||||
result = [first_blk]
|
||||
for i in xrange(num-1):
|
||||
for i in range(num-1):
|
||||
blk_num = self.find_free()
|
||||
if blk_num == None:
|
||||
return None
|
||||
@ -200,14 +200,14 @@ class ADFSBitmap:
|
||||
|
||||
def get_num_free(self):
|
||||
num = 0
|
||||
for i in xrange(self.bitmap_bits):
|
||||
for i in range(self.bitmap_bits):
|
||||
if self.get_bit(i):
|
||||
num+=1
|
||||
return num
|
||||
|
||||
def get_num_used(self):
|
||||
num = 0
|
||||
for i in xrange(self.bitmap_bits):
|
||||
for i in range(self.bitmap_bits):
|
||||
if not self.get_bit(i):
|
||||
num+=1
|
||||
return num
|
||||
@ -270,14 +270,14 @@ class ADFSBitmap:
|
||||
|
||||
def create_draw_bitmap(self):
|
||||
bm = ctypes.create_string_buffer(self.blkdev.num_blocks)
|
||||
for i in xrange(self.blkdev.num_blocks):
|
||||
for i in range(self.blkdev.num_blocks):
|
||||
bm[i] = chr(0)
|
||||
return bm
|
||||
|
||||
def print_free(self, brief=False):
|
||||
bm = self.create_draw_bitmap()
|
||||
res = self.blkdev.reserved
|
||||
for i in xrange(self.blkdev.num_blocks):
|
||||
for i in range(self.blkdev.num_blocks):
|
||||
if i >= res and self.get_bit(i):
|
||||
bm[i] = 'F'
|
||||
self.print_draw_bitmap(bm, brief)
|
||||
@ -285,7 +285,7 @@ class ADFSBitmap:
|
||||
def print_used(self, brief=False):
|
||||
bm = self.create_draw_bitmap()
|
||||
res = self.blkdev.reserved
|
||||
for i in xrange(self.blkdev.num_blocks):
|
||||
for i in range(self.blkdev.num_blocks):
|
||||
if i >= res and not self.get_bit(i):
|
||||
bm[i] = '#'
|
||||
self.print_draw_bitmap(bm, brief)
|
||||
@ -308,7 +308,7 @@ class ADFSBitmap:
|
||||
blk = 0
|
||||
blk_cyl = self.blkdev.sectors * self.blkdev.heads
|
||||
found = False
|
||||
for i in xrange(self.blkdev.num_blocks):
|
||||
for i in range(self.blkdev.num_blocks):
|
||||
c = bm[i]
|
||||
if ord(c) == 0:
|
||||
c = '.'
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
from __future__ import absolute_import
|
||||
from __future__ import print_function
|
||||
|
||||
|
||||
|
||||
import struct
|
||||
from .block.Block import Block
|
||||
@ -57,7 +57,7 @@ class ADFSDir(ADFSNode):
|
||||
|
||||
def _init_name_hash(self):
|
||||
self.name_hash = []
|
||||
for i in xrange(self.block.hash_size):
|
||||
for i in range(self.block.hash_size):
|
||||
self.name_hash.append([])
|
||||
|
||||
def read(self, recursive=False):
|
||||
@ -66,7 +66,7 @@ class ADFSDir(ADFSNode):
|
||||
|
||||
# create initial list with blk_num/hash_index for dir scan
|
||||
blocks = []
|
||||
for i in xrange(self.block.hash_size):
|
||||
for i in range(self.block.hash_size):
|
||||
blk_num = self.block.hash_table[i]
|
||||
if blk_num != 0:
|
||||
blocks.append((blk_num,i))
|
||||
@ -231,7 +231,7 @@ class ADFSDir(ADFSNode):
|
||||
names = self.name_hash[hash_key]
|
||||
# find my node
|
||||
pos = None
|
||||
for i in xrange(len(names)):
|
||||
for i in range(len(names)):
|
||||
if names[i] == node:
|
||||
pos = i
|
||||
break
|
||||
@ -431,7 +431,7 @@ class ADFSDir(ADFSNode):
|
||||
dcb = None
|
||||
record = None
|
||||
n = len(self.dcache_blks)
|
||||
for i in xrange(n):
|
||||
for i in range(n):
|
||||
dcb = self.dcache_blks[i]
|
||||
record = dcb.get_record_by_name(name)
|
||||
if record != None:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
from __future__ import absolute_import
|
||||
from __future__ import print_function
|
||||
|
||||
|
||||
|
||||
from .block.EntryBlock import EntryBlock
|
||||
from .block.FileHeaderBlock import FileHeaderBlock
|
||||
@ -163,12 +163,12 @@ class ADFSFile(ADFSNode):
|
||||
fhb_num = free_blks[0]
|
||||
# ... for ext
|
||||
self.ext_blk_nums = []
|
||||
for i in xrange(self.num_ext_blks):
|
||||
for i in range(self.num_ext_blks):
|
||||
self.ext_blk_nums.append(free_blks[1+i])
|
||||
# ... for data
|
||||
off = 1 + self.num_ext_blks
|
||||
self.data_blk_nums = []
|
||||
for i in xrange(self.num_data_blks):
|
||||
for i in range(self.num_data_blks):
|
||||
self.data_blk_nums.append(free_blks[off])
|
||||
off += 1
|
||||
|
||||
@ -190,7 +190,7 @@ class ADFSFile(ADFSNode):
|
||||
|
||||
# create file list (=ext) blocks
|
||||
ext_off = ppb
|
||||
for i in xrange(self.num_ext_blks):
|
||||
for i in range(self.num_ext_blks):
|
||||
flb = FileListBlock(self.blkdev, self.ext_blk_nums[i])
|
||||
if i == self.num_ext_blks - 1:
|
||||
ext_blk = 0
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
from __future__ import absolute_import
|
||||
from __future__ import print_function
|
||||
|
||||
|
||||
|
||||
from .block.CommentBlock import CommentBlock
|
||||
from .block.EntryBlock import EntryBlock
|
||||
@ -142,12 +142,12 @@ class ADFSNode:
|
||||
self.change_meta_info(MetaInfo(mod_ts=t))
|
||||
|
||||
def get_list_str(self, indent=0, all=False, detail=False):
|
||||
istr = u' ' * indent
|
||||
istr = ' ' * indent
|
||||
if detail:
|
||||
extra = self.get_detail_str()
|
||||
else:
|
||||
extra = self.meta_info.get_str_line()
|
||||
return u'%-40s %8s %s' % (istr + self.name.get_unicode_name(), self.get_size_str(), extra)
|
||||
return '%-40s %8s %s' % (istr + self.name.get_unicode_name(), self.get_size_str(), extra)
|
||||
|
||||
def list(self, indent=0, all=False, detail=False, encoding="UTF-8"):
|
||||
print(self.get_list_str(indent=indent, all=all, detail=detail).encode(encoding))
|
||||
@ -183,7 +183,7 @@ class ADFSNode:
|
||||
|
||||
def get_node_path_name(self, with_vol=False):
|
||||
r = self.get_node_path()
|
||||
return FSString(u"/".join(r))
|
||||
return FSString("/".join(r))
|
||||
|
||||
def get_detail_str(self):
|
||||
return ""
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
from __future__ import absolute_import
|
||||
from __future__ import print_function
|
||||
|
||||
|
||||
|
||||
from .ADFSDir import ADFSDir
|
||||
from .MetaInfo import MetaInfo
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
from __future__ import absolute_import
|
||||
from __future__ import print_function
|
||||
|
||||
|
||||
|
||||
from .block.BootBlock import BootBlock
|
||||
from .block.RootBlock import RootBlock
|
||||
|
||||
@ -58,19 +58,19 @@ class FSError(Exception):
|
||||
return self.__unicode__().encode("UTF-8")
|
||||
|
||||
def __unicode__(self):
|
||||
if error_names.has_key(self.code):
|
||||
code_str = unicode(error_names[self.code])
|
||||
if self.code in error_names:
|
||||
code_str = str(error_names[self.code])
|
||||
else:
|
||||
code_str = u"?"
|
||||
code_str = "?"
|
||||
srcs = []
|
||||
if self.node != None:
|
||||
srcs.append(u"node=" + unicode(self.node))
|
||||
srcs.append("node=" + str(self.node))
|
||||
if self.block != None:
|
||||
srcs.append(u"block=" + unicode(self.block))
|
||||
srcs.append("block=" + str(self.block))
|
||||
if self.file_name != None:
|
||||
srcs.append(u"file_name=" + self.file_name.get_unicode())
|
||||
srcs.append("file_name=" + self.file_name.get_unicode())
|
||||
if self.extra != None:
|
||||
srcs.append(unicode(self.extra))
|
||||
return u"%s(%d):%s" % (code_str, self.code, ",".join(srcs))
|
||||
srcs.append(str(self.extra))
|
||||
return "%s(%d):%s" % (code_str, self.code, ",".join(srcs))
|
||||
|
||||
|
||||
@ -12,7 +12,7 @@ class FSString:
|
||||
"""
|
||||
if sys.version_info[0] == 3 and type(txt) == str:
|
||||
self.txt = txt
|
||||
elif type(txt) == unicode:
|
||||
elif type(txt) == str:
|
||||
self.txt = txt
|
||||
elif type(txt) == str:
|
||||
self.txt = txt.decode(encoding)
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
from __future__ import absolute_import
|
||||
from __future__ import print_function
|
||||
|
||||
|
||||
|
||||
from .FSString import FSString
|
||||
|
||||
class FileName:
|
||||
root_path_aliases = (u'', u'/', u':')
|
||||
root_path_aliases = ('', '/', ':')
|
||||
|
||||
def __init__(self, name, is_intl=False, is_longname=False):
|
||||
# check that name is a FSString
|
||||
@ -36,7 +36,7 @@ class FileName:
|
||||
def get_dir_and_base_name(self):
|
||||
"""Return portion after last slash '/' or the full name in unicode"""
|
||||
s = self.name.get_unicode()
|
||||
pos = s.rfind(u'/')
|
||||
pos = s.rfind('/')
|
||||
if pos != -1:
|
||||
dir_name = s[:pos]
|
||||
file_name = s[pos+1:]
|
||||
@ -51,7 +51,7 @@ class FileName:
|
||||
result = self.name.get_ami_str().upper()
|
||||
if self.is_intl:
|
||||
r = ""
|
||||
for i in xrange(len(result)):
|
||||
for i in range(len(result)):
|
||||
o = ord(result[i])
|
||||
if o >= 224 and o <= 254 and o != 247:
|
||||
r += chr(o - (ord('a')-ord('A')))
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
from __future__ import absolute_import
|
||||
from __future__ import print_function
|
||||
|
||||
|
||||
|
||||
import os
|
||||
import os.path
|
||||
@ -31,7 +31,7 @@ class Imager:
|
||||
|
||||
def to_path_str(self, u):
|
||||
"""convert a unicode string to OS path name encoding"""
|
||||
if type(u) != unicode:
|
||||
if type(u) != str:
|
||||
raise ValueError("to_path_str: must pass a unicode string")
|
||||
return u.encode(self.path_encoding)
|
||||
|
||||
@ -205,8 +205,8 @@ class Imager:
|
||||
# retrieve meta info for path from DB
|
||||
if self.meta_db != None:
|
||||
ami_path = parent_node.get_node_path_name().get_unicode()
|
||||
if ami_path != u"":
|
||||
ami_path += u"/" + ami_name
|
||||
if ami_path != "":
|
||||
ami_path += "/" + ami_name
|
||||
else:
|
||||
ami_path = ami_name
|
||||
meta_info = self.meta_db.get_meta_info(ami_path)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
from __future__ import absolute_import
|
||||
from __future__ import print_function
|
||||
|
||||
|
||||
|
||||
from .MetaInfo import MetaInfo
|
||||
from .RootMetaInfo import RootMetaInfo
|
||||
@ -23,7 +23,7 @@ class MetaDB:
|
||||
return self.vol_meta
|
||||
|
||||
def set_volume_name(self, name):
|
||||
if type(name) != unicode:
|
||||
if type(name) != str:
|
||||
raise ValueError("set_volume_name must be unicode")
|
||||
self.vol_name = name
|
||||
|
||||
@ -37,12 +37,12 @@ class MetaDB:
|
||||
return self.dos_type
|
||||
|
||||
def set_meta_info(self, path, meta_info):
|
||||
if type(path) != unicode:
|
||||
if type(path) != str:
|
||||
raise ValueError("set_meta_info: path must be unicode")
|
||||
self.metas[path] = meta_info
|
||||
|
||||
def get_meta_info(self, path):
|
||||
if self.metas.has_key(path):
|
||||
if path in self.metas:
|
||||
return self.metas[path]
|
||||
else:
|
||||
return None
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
from __future__ import absolute_import
|
||||
from __future__ import print_function
|
||||
|
||||
|
||||
|
||||
from .ProtectFlags import *
|
||||
from .TimeStamp import *
|
||||
@ -21,10 +21,10 @@ class MetaInfo:
|
||||
res.append(self.get_mod_time_str())
|
||||
comment = self.get_comment()
|
||||
if comment == None:
|
||||
res.append(u'')
|
||||
res.append('')
|
||||
else:
|
||||
res.append(self.get_comment().get_unicode())
|
||||
return u' '.join(res)
|
||||
return ' '.join(res)
|
||||
|
||||
def get_mod_time_str(self):
|
||||
if self.mod_ts != None:
|
||||
@ -109,4 +109,4 @@ class MetaInfo:
|
||||
if self.comment != None:
|
||||
return self.comment.get_unicode()
|
||||
else:
|
||||
return u""
|
||||
return ""
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
from __future__ import absolute_import
|
||||
from __future__ import print_function
|
||||
|
||||
|
||||
|
||||
from .FSError import *
|
||||
|
||||
@ -24,7 +24,7 @@ class ProtectFlags:
|
||||
txt = ""
|
||||
pos = self.flag_num - 1
|
||||
m = 1 << pos
|
||||
for i in xrange(self.flag_num):
|
||||
for i in range(self.flag_num):
|
||||
bit = self.mask & m == m
|
||||
show = '-'
|
||||
flg = self.flag_txt[i]
|
||||
@ -43,7 +43,7 @@ class ProtectFlags:
|
||||
def bin_str(self):
|
||||
res = ""
|
||||
m = 1 << (self.flag_num - 1)
|
||||
for i in xrange(self.flag_num):
|
||||
for i in range(self.flag_num):
|
||||
if m & self.mask == m:
|
||||
res += "1"
|
||||
else:
|
||||
@ -67,7 +67,7 @@ class ProtectFlags:
|
||||
else:
|
||||
mask = None
|
||||
is_low = None
|
||||
for i in xrange(self.flag_num):
|
||||
for i in range(self.flag_num):
|
||||
flg = self.flag_txt[i]
|
||||
flg_low = flg.lower()
|
||||
if flg_low == a:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
from __future__ import absolute_import
|
||||
from __future__ import print_function
|
||||
|
||||
|
||||
|
||||
from .ADFSVolume import ADFSVolume
|
||||
from amitools.fs.blkdev.BlkDevFactory import BlkDevFactory
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
from __future__ import absolute_import
|
||||
from __future__ import print_function
|
||||
|
||||
|
||||
|
||||
import time
|
||||
from .TimeStamp import *
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
from __future__ import absolute_import
|
||||
from __future__ import print_function
|
||||
|
||||
|
||||
|
||||
import time
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
from __future__ import absolute_import
|
||||
from __future__ import print_function
|
||||
|
||||
|
||||
|
||||
from .BlockDevice import BlockDevice
|
||||
import ctypes
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
from __future__ import absolute_import
|
||||
from __future__ import print_function
|
||||
|
||||
|
||||
|
||||
import os
|
||||
import os.path
|
||||
@ -149,7 +149,7 @@ class BlkDevFactory:
|
||||
raise IOError("can't open rdisk of image file")
|
||||
# determine partition
|
||||
p = "0"
|
||||
if options != None and options.has_key('part'):
|
||||
if options != None and 'part' in options:
|
||||
p = str(options['part'])
|
||||
part = rdisk.find_partition_by_string(p)
|
||||
if part == None:
|
||||
@ -192,7 +192,7 @@ class BlkDevFactory:
|
||||
# --- mini test ---
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
import StringIO
|
||||
import io
|
||||
bdf = BlkDevFactory()
|
||||
for a in sys.argv[1:]:
|
||||
# open by file
|
||||
@ -202,7 +202,7 @@ if __name__ == '__main__':
|
||||
# open via fobj
|
||||
fobj = file(a,"rb")
|
||||
data = fobj.read()
|
||||
nobj = StringIO.StringIO(data)
|
||||
nobj = io.StringIO(data)
|
||||
blkdev = bdf.open("bluna"+a, fobj=nobj)
|
||||
print(a, blkdev.__class__.__name__)
|
||||
blkdev.close()
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
from __future__ import absolute_import
|
||||
from __future__ import print_function
|
||||
|
||||
|
||||
|
||||
# a block device defines a set of blocks used by a file system
|
||||
from .DiskGeometry import DiskGeometry
|
||||
|
||||
@ -39,7 +39,7 @@ class DiskGeometry:
|
||||
algo = None
|
||||
if options != None:
|
||||
(c, h, s) = self._parse_chs(options)
|
||||
if options.has_key('algo'):
|
||||
if 'algo' in options:
|
||||
algo = int(options['algo'])
|
||||
# chs if fully specified then take this one
|
||||
if c != None and h != None and s != None:
|
||||
@ -73,7 +73,7 @@ class DiskGeometry:
|
||||
return self.get_num_bytes()
|
||||
else:
|
||||
# we require a size
|
||||
if not options.has_key('size'):
|
||||
if 'size' not in options:
|
||||
return None
|
||||
# parse size
|
||||
size = options['size']
|
||||
@ -83,7 +83,7 @@ class DiskGeometry:
|
||||
return None
|
||||
# select guess algo
|
||||
algo = None
|
||||
if options.has_key('algo'):
|
||||
if 'algo' in options:
|
||||
algo = int(options['algo'])
|
||||
# guess size
|
||||
return self._guess_for_size(size, approx=True, algo=algo, secs=s, heads=h)
|
||||
@ -93,16 +93,16 @@ class DiskGeometry:
|
||||
h = None
|
||||
s = None
|
||||
# chs=<n>,<n>,<n>
|
||||
if options.has_key('chs'):
|
||||
if 'chs' in options:
|
||||
comp = options['chs'].split(',')
|
||||
if len(comp) == 3:
|
||||
return map(lambda x: int(x), comp)
|
||||
return [int(x) for x in comp]
|
||||
else:
|
||||
if options.has_key('s'):
|
||||
if 's' in options:
|
||||
s = int(options['s'])
|
||||
if options.has_key('h'):
|
||||
if 'h' in options:
|
||||
h = int(options['h'])
|
||||
if options.has_key('c'):
|
||||
if 'c' in options:
|
||||
c = int(options['c'])
|
||||
return (c,h,s)
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
from __future__ import absolute_import
|
||||
from __future__ import print_function
|
||||
|
||||
|
||||
|
||||
from .BlockDevice import BlockDevice
|
||||
from .DiskGeometry import DiskGeometry
|
||||
|
||||
@ -84,12 +84,12 @@ class ImageFile:
|
||||
raise IOError("Can't create image file in read only mode")
|
||||
block = '\0' * self.block_bytes
|
||||
if self.fobj is not None:
|
||||
for i in xrange(num_blocks):
|
||||
for i in range(num_blocks):
|
||||
self.fobj.write(block)
|
||||
self.fobj.seek(0,0)
|
||||
else:
|
||||
fh = file(self.file_name, "wb")
|
||||
for i in xrange(num_blocks):
|
||||
for i in range(num_blocks):
|
||||
fh.write(block)
|
||||
fh.close()
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
from __future__ import absolute_import
|
||||
from __future__ import print_function
|
||||
|
||||
|
||||
|
||||
from .BlockDevice import BlockDevice
|
||||
import os.path
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
from __future__ import absolute_import
|
||||
from __future__ import print_function
|
||||
|
||||
|
||||
|
||||
from .BlockDevice import BlockDevice
|
||||
import os.path
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
from __future__ import absolute_import
|
||||
from __future__ import print_function
|
||||
|
||||
|
||||
|
||||
from .Block import Block
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
from __future__ import absolute_import
|
||||
from __future__ import print_function
|
||||
|
||||
|
||||
|
||||
from .Block import Block
|
||||
from amitools.util.HexDump import *
|
||||
@ -19,7 +19,7 @@ class BitmapExtBlock(Block):
|
||||
def _read(self):
|
||||
# read bitmap blk ptrs
|
||||
self.bitmap_ptrs = []
|
||||
for i in xrange(self.blkdev.block_longs-1):
|
||||
for i in range(self.blkdev.block_longs-1):
|
||||
bm_blk = self._get_long(i)
|
||||
self.bitmap_ptrs.append(bm_blk)
|
||||
|
||||
@ -30,7 +30,7 @@ class BitmapExtBlock(Block):
|
||||
|
||||
def create(self):
|
||||
self.bitmap_ptrs = []
|
||||
for i in xrange(self.blkdev.block_longs-1):
|
||||
for i in range(self.blkdev.block_longs-1):
|
||||
self.bitmap_ptrs.append(0)
|
||||
self.bitmap_ext_blk = 0
|
||||
self.valid = True
|
||||
@ -38,7 +38,7 @@ class BitmapExtBlock(Block):
|
||||
|
||||
def write(self):
|
||||
self._create_data()
|
||||
for i in xrange(self.blkdev.block_longs-1):
|
||||
for i in range(self.blkdev.block_longs-1):
|
||||
self._put_long(i, self.bitmap_ptrs[i])
|
||||
self._put_long(-1, self.bitmap_ext_blk)
|
||||
self._write_data()
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
from __future__ import absolute_import
|
||||
from __future__ import print_function
|
||||
|
||||
|
||||
|
||||
import struct
|
||||
import ctypes
|
||||
@ -149,7 +149,7 @@ class Block:
|
||||
|
||||
def _calc_chksum(self):
|
||||
chksum = 0
|
||||
for i in xrange(self.block_longs):
|
||||
for i in range(self.block_longs):
|
||||
if i != self.chk_loc:
|
||||
chksum += self._get_long(i)
|
||||
return (-chksum) & 0xffffffff
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
from __future__ import absolute_import
|
||||
from __future__ import print_function
|
||||
|
||||
|
||||
|
||||
import os.path
|
||||
import sys
|
||||
@ -36,7 +36,7 @@ class BootBlock(Block):
|
||||
self.got_root_blk = self.calc_root_blk
|
||||
# create extra blks
|
||||
self.extra_blks = []
|
||||
for i in xrange(self.num_extra):
|
||||
for i in range(self.num_extra):
|
||||
b = Block(self.blkdev, self.blk_num + 1 + i)
|
||||
b._create_data()
|
||||
self.extra_blks.append(b)
|
||||
@ -60,7 +60,7 @@ class BootBlock(Block):
|
||||
n = self.blkdev.block_longs
|
||||
chksum = 0
|
||||
for blk in all_blks:
|
||||
for i in xrange(n):
|
||||
for i in range(n):
|
||||
if i != 1: # skip chksum
|
||||
chksum += blk._get_long(i)
|
||||
if chksum > 0xffffffff:
|
||||
@ -72,7 +72,7 @@ class BootBlock(Block):
|
||||
self._read_data()
|
||||
# read extra boot blocks
|
||||
self.extra_blks = []
|
||||
for i in xrange(self.num_extra):
|
||||
for i in range(self.num_extra):
|
||||
b = Block(self.blkdev, self.blk_num + 1 + i)
|
||||
b._read_data()
|
||||
self.extra_blks.append(b)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
from __future__ import absolute_import
|
||||
from __future__ import print_function
|
||||
|
||||
|
||||
|
||||
import time
|
||||
from .Block import Block
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
from __future__ import absolute_import
|
||||
from __future__ import print_function
|
||||
|
||||
|
||||
|
||||
import time
|
||||
import struct
|
||||
@ -100,7 +100,7 @@ class DirCacheBlock(Block):
|
||||
|
||||
# get records
|
||||
off = 24
|
||||
for i in xrange(self.num_records):
|
||||
for i in range(self.num_records):
|
||||
r = DirCacheRecord()
|
||||
off = r.get(self.data, off)
|
||||
if off == -1:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
from __future__ import absolute_import
|
||||
from __future__ import print_function
|
||||
|
||||
|
||||
|
||||
from .Block import Block
|
||||
from .CommentBlock import CommentBlock
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
from __future__ import absolute_import
|
||||
from __future__ import print_function
|
||||
|
||||
|
||||
|
||||
from .Block import Block
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
from __future__ import absolute_import
|
||||
from __future__ import print_function
|
||||
|
||||
|
||||
|
||||
import time
|
||||
from .Block import Block
|
||||
@ -36,7 +36,7 @@ class FileHeaderBlock(EntryBlock):
|
||||
if bc > mbc:
|
||||
bc = mbc
|
||||
self.data_blocks = []
|
||||
for i in xrange(bc):
|
||||
for i in range(bc):
|
||||
self.data_blocks.append(self._get_long(-51-i))
|
||||
|
||||
self.protect = self._get_long(-48)
|
||||
@ -57,7 +57,7 @@ class FileHeaderBlock(EntryBlock):
|
||||
self._put_long(4, self.first_data)
|
||||
|
||||
# data blocks
|
||||
for i in xrange(len(self.data_blocks)):
|
||||
for i in range(len(self.data_blocks)):
|
||||
self._put_long(-51-i, self.data_blocks[i])
|
||||
|
||||
self._put_long(-48, self.protect)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
from __future__ import absolute_import
|
||||
from __future__ import print_function
|
||||
|
||||
|
||||
|
||||
from .Block import Block
|
||||
|
||||
@ -30,7 +30,7 @@ class FileListBlock(Block):
|
||||
if bc > mbc:
|
||||
bc = mbc
|
||||
self.data_blocks = []
|
||||
for i in xrange(bc):
|
||||
for i in range(bc):
|
||||
self.data_blocks.append(self._get_long(-51-i))
|
||||
|
||||
self.parent = self._get_long(-3)
|
||||
@ -55,7 +55,7 @@ class FileListBlock(Block):
|
||||
self._put_long(2, self.block_count)
|
||||
|
||||
# data blocks
|
||||
for i in xrange(len(self.data_blocks)):
|
||||
for i in range(len(self.data_blocks)):
|
||||
self._put_long(-51-i, self.data_blocks[i])
|
||||
|
||||
self._put_long(-3, self.parent)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
from __future__ import absolute_import
|
||||
from __future__ import print_function
|
||||
|
||||
|
||||
|
||||
import sys
|
||||
import time
|
||||
@ -20,7 +20,7 @@ class RootBlock(Block):
|
||||
# init fresh hash table
|
||||
self.hash_size = self.blkdev.block_longs - 56
|
||||
self.hash_table = []
|
||||
for i in xrange(self.hash_size):
|
||||
for i in range(self.hash_size):
|
||||
self.hash_table.append(0)
|
||||
|
||||
# timestamps
|
||||
@ -34,7 +34,7 @@ class RootBlock(Block):
|
||||
# bitmap: blank
|
||||
self.bitmap_flag = 0xffffffff
|
||||
self.bitmap_ptrs = []
|
||||
for i in xrange(25):
|
||||
for i in range(25):
|
||||
self.bitmap_ptrs.append(0)
|
||||
self.bitmap_ext_blk = 0
|
||||
|
||||
@ -49,12 +49,12 @@ class RootBlock(Block):
|
||||
|
||||
# hash table
|
||||
self._put_long(3, self.hash_size)
|
||||
for i in xrange(self.hash_size):
|
||||
for i in range(self.hash_size):
|
||||
self._put_long(6+i, self.hash_table[i])
|
||||
|
||||
# bitmap
|
||||
self._put_long(-50, self.bitmap_flag)
|
||||
for i in xrange(25):
|
||||
for i in range(25):
|
||||
self._put_long(-49+i, self.bitmap_ptrs[i])
|
||||
self._put_long(-24, self.bitmap_ext_blk)
|
||||
|
||||
@ -95,13 +95,13 @@ class RootBlock(Block):
|
||||
if hs > mhs:
|
||||
hs = mhs
|
||||
self.hash_table = []
|
||||
for i in xrange(hs):
|
||||
for i in range(hs):
|
||||
self.hash_table.append(self._get_long(6+i))
|
||||
|
||||
# bitmap
|
||||
self.bitmap_flag = self._get_long(-50)
|
||||
self.bitmap_ptrs = []
|
||||
for i in xrange(25):
|
||||
for i in range(25):
|
||||
bm_blk = self._get_long(-49+i)
|
||||
self.bitmap_ptrs.append(bm_blk)
|
||||
self.bitmap_ext_blk = self._get_long(-24)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
from __future__ import absolute_import
|
||||
from __future__ import print_function
|
||||
|
||||
|
||||
|
||||
import time
|
||||
from .Block import Block
|
||||
@ -34,7 +34,7 @@ class UserDirBlock(EntryBlock):
|
||||
# hash table of entries
|
||||
self.hash_table = []
|
||||
self.hash_size = self.blkdev.block_longs - 56
|
||||
for i in xrange(self.hash_size):
|
||||
for i in range(self.hash_size):
|
||||
self.hash_table.append(self._get_long(6+i))
|
||||
|
||||
self.valid = (self.own_key == self.blk_num)
|
||||
@ -57,7 +57,7 @@ class UserDirBlock(EntryBlock):
|
||||
# empty hash table
|
||||
self.hash_table = []
|
||||
self.hash_size = self.blkdev.block_longs - 56
|
||||
for i in xrange(self.hash_size):
|
||||
for i in range(self.hash_size):
|
||||
self.hash_table.append(0)
|
||||
self.valid = True
|
||||
return True
|
||||
@ -71,7 +71,7 @@ class UserDirBlock(EntryBlock):
|
||||
self._put_long(-3, self.parent)
|
||||
self._put_long(-2, self.extension)
|
||||
# hash table
|
||||
for i in xrange(self.hash_size):
|
||||
for i in range(self.hash_size):
|
||||
self._put_long(6+i, self.hash_table[i])
|
||||
Block.write(self)
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
from __future__ import absolute_import
|
||||
from __future__ import print_function
|
||||
|
||||
|
||||
|
||||
from ..Block import Block
|
||||
|
||||
@ -56,6 +56,6 @@ class BadBlockBlock(Block):
|
||||
print(" next: %s" % self._dump_ptr(self.next))
|
||||
n = len(self.block_pairs) / 2
|
||||
o = 0
|
||||
for i in xrange(n):
|
||||
for i in range(n):
|
||||
print(" bad=%d good=%d" % (self.block_pairs[o], self.block_pairs[o+1]))
|
||||
o += 2
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
from __future__ import absolute_import
|
||||
from __future__ import print_function
|
||||
|
||||
|
||||
|
||||
from amitools.fs.block.Block import *
|
||||
import amitools.fs.DosType as DosType
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
from __future__ import absolute_import
|
||||
from __future__ import print_function
|
||||
|
||||
|
||||
|
||||
from ..Block import Block
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
from __future__ import absolute_import
|
||||
from __future__ import print_function
|
||||
|
||||
|
||||
|
||||
from amitools.fs.block.Block import *
|
||||
import amitools.fs.DosType as DosType
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
from __future__ import absolute_import
|
||||
from __future__ import print_function
|
||||
|
||||
|
||||
|
||||
from ..Block import Block
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
from __future__ import absolute_import
|
||||
from __future__ import print_function
|
||||
|
||||
|
||||
|
||||
from amitools.fs.block.rdb.FSHeaderBlock import *
|
||||
from amitools.fs.block.rdb.LoadSegBlock import *
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
from __future__ import absolute_import
|
||||
from __future__ import print_function
|
||||
|
||||
|
||||
|
||||
from amitools.fs.block.rdb.RDBlock import *
|
||||
from amitools.fs.block.rdb.PartitionBlock import *
|
||||
@ -128,7 +128,7 @@ class RDisk:
|
||||
|
||||
def get_block_map(self):
|
||||
res = []
|
||||
for i in xrange(self.max_blks):
|
||||
for i in range(self.max_blks):
|
||||
blk = None
|
||||
# check partitions
|
||||
if i == 0:
|
||||
@ -331,7 +331,7 @@ class RDisk:
|
||||
|
||||
def get_free_blocks(self):
|
||||
res = []
|
||||
for i in xrange(self.max_blks):
|
||||
for i in range(self.max_blks):
|
||||
if i not in self.used_blks:
|
||||
res.append(i)
|
||||
return res
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
from __future__ import absolute_import
|
||||
from __future__ import print_function
|
||||
|
||||
|
||||
|
||||
from amitools.fs.validate.Log import Log
|
||||
import struct
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
from __future__ import absolute_import
|
||||
from __future__ import print_function
|
||||
|
||||
|
||||
|
||||
import time
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
from __future__ import absolute_import
|
||||
from __future__ import print_function
|
||||
|
||||
|
||||
|
||||
from .BlockScan import BlockScan
|
||||
from amitools.fs.FSString import FSString
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
from __future__ import absolute_import
|
||||
from __future__ import print_function
|
||||
|
||||
|
||||
|
||||
from .BlockScan import BlockScan
|
||||
from amitools.fs.FSString import FSString
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
from __future__ import absolute_import
|
||||
from __future__ import print_function
|
||||
|
||||
|
||||
|
||||
class LogEntry:
|
||||
"""A class for a log entry"""
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
from __future__ import absolute_import
|
||||
from __future__ import print_function
|
||||
|
||||
|
||||
|
||||
import sys
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
from __future__ import absolute_import
|
||||
from __future__ import print_function
|
||||
|
||||
|
||||
|
||||
from amitools.fs.block.BootBlock import BootBlock
|
||||
from amitools.fs.block.RootBlock import RootBlock
|
||||
|
||||
@ -82,6 +82,6 @@ if __name__ == '__main__':
|
||||
bin_img = bf.load_image(f)
|
||||
print(bin_img)
|
||||
bkm = BlizKickModule(bin_img)
|
||||
print(bkm.bk_type)
|
||||
print((bkm.bk_type))
|
||||
bkm.fix_module()
|
||||
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
from __future__ import print_function
|
||||
|
||||
|
||||
import os
|
||||
import struct
|
||||
|
||||
from RomAccess import RomAccess
|
||||
from .RomAccess import RomAccess
|
||||
|
||||
class KickRomAccess(RomAccess):
|
||||
|
||||
@ -56,7 +56,7 @@ class KickRomAccess(RomAccess):
|
||||
# expect 0x0019 ... 0x001f
|
||||
off = self.size - 14
|
||||
num = 0x19
|
||||
for i in xrange(7):
|
||||
for i in range(7):
|
||||
val = self.read_word(off)
|
||||
if val != num:
|
||||
return False
|
||||
@ -84,7 +84,7 @@ class KickRomAccess(RomAccess):
|
||||
num_longs = self.size / 4
|
||||
off = 0
|
||||
max_u32 = 0xffffffff
|
||||
for i in xrange(num_longs):
|
||||
for i in range(num_longs):
|
||||
val = struct.unpack_from(">I", self.rom_data, off)[0]
|
||||
if off != skip_off:
|
||||
chk_sum += val
|
||||
@ -144,7 +144,7 @@ class KickRomAccess(RomAccess):
|
||||
def write_footer(self):
|
||||
off = self.size - 0x10
|
||||
num = 0x18
|
||||
for i in xrange(8):
|
||||
for i in range(8):
|
||||
self.write_word(off, num)
|
||||
num += 1
|
||||
off += 2
|
||||
@ -205,7 +205,7 @@ class Loader(object):
|
||||
def _decode(cls, img, rom_key):
|
||||
data = bytearray(img)
|
||||
n = len(rom_key)
|
||||
for i in xrange(len(data)):
|
||||
for i in range(len(data)):
|
||||
off = i % n
|
||||
data[i] = data[i] ^ ord(rom_key[off])
|
||||
return bytes(data)
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
from __future__ import print_function
|
||||
|
||||
|
||||
import os
|
||||
import struct
|
||||
@ -48,13 +48,13 @@ class RemusRomModuleExtra(object):
|
||||
|
||||
def dump(self):
|
||||
if len(self.relocs) > 0:
|
||||
print(" relocs: ", ",".join(map(lambda x: "%08x" % x, self.relocs)))
|
||||
print(" relocs: ", ",".join(["%08x" % x for x in self.relocs]))
|
||||
if len(self.patches) > 0:
|
||||
print(" patches:", ",".join(map(lambda x: "%08x:%08x" % x, self.patches)))
|
||||
print(" patches:", ",".join(["%08x:%08x" % x for x in self.patches]))
|
||||
if len(self.brelocs) > 0:
|
||||
print(" brelocs:", ",".join(map(lambda x: "%08x" % x, self.brelocs)))
|
||||
print(" brelocs:", ",".join(["%08x" % x for x in self.brelocs]))
|
||||
if len(self.fixes) > 0:
|
||||
print(" fixes: ", ",".join(map(lambda x: "%08x:%08x" % x, self.fixes)))
|
||||
print(" fixes: ", ",".join(["%08x:%08x" % x for x in self.fixes]))
|
||||
if self.chk_sum:
|
||||
print(" chk_sum: %08x" % self.chk_sum)
|
||||
|
||||
@ -225,39 +225,39 @@ class RemusSplitFile(RemusFile):
|
||||
# short patch
|
||||
if flags & FLAG_SHORT_PATCHES:
|
||||
num = self._read_word()
|
||||
for i in xrange(num):
|
||||
for i in range(num):
|
||||
offset = self._read_word()
|
||||
val = self._read_long()
|
||||
patches.append((offset,val))
|
||||
# long patch
|
||||
if flags & FLAG_LONG_PATCHES:
|
||||
num_patches = self._read_word()
|
||||
for i in xrange(num_patches):
|
||||
for i in range(num_patches):
|
||||
offset = self._read_long()
|
||||
val = self._read_long()
|
||||
patches.append((offset,val))
|
||||
# short relocs
|
||||
if flags & FLAG_SHORT_RELOCS:
|
||||
num_short_relocs = self._read_word()
|
||||
for i in xrange(num_short_relocs):
|
||||
for i in range(num_short_relocs):
|
||||
off = self._read_word()
|
||||
relocs.append(off)
|
||||
# long relocs
|
||||
if flags & FLAG_LONG_RELOCS:
|
||||
num_long_relocs = self._read_word()
|
||||
for i in xrange(num_long_relocs):
|
||||
for i in range(num_long_relocs):
|
||||
off = self._read_long()
|
||||
relocs.append(off)
|
||||
# old dos.library BCPL relocs
|
||||
if flags & FLAG_SHORT_BCPL_RELOCS:
|
||||
num = self._read_word()
|
||||
for i in xrange(num):
|
||||
for i in range(num):
|
||||
off = self._read_word()
|
||||
brelocs.append(off)
|
||||
# fixes
|
||||
if flags & FLAG_FIXES:
|
||||
num = self._read_word()
|
||||
for i in xrange(num):
|
||||
for i in range(num):
|
||||
off = self._read_long()
|
||||
val = self._read_long()
|
||||
fixes.append((off,val))
|
||||
@ -372,7 +372,7 @@ class RemusFileSet(object):
|
||||
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
import KickRom
|
||||
from . import KickRom
|
||||
|
||||
if len(sys.argv) > 0:
|
||||
for f in sys.argv[1:]:
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
from RomAccess import RomAccess
|
||||
from .RomAccess import RomAccess
|
||||
|
||||
|
||||
RTC_MATCHWORD = 0x4AFC
|
||||
@ -145,10 +145,10 @@ class ResidentScan:
|
||||
base_map[base_addr] += 1
|
||||
# one match
|
||||
if len(base_map) == 1:
|
||||
addr = base_map.keys()[0]
|
||||
addr = list(base_map.keys())[0]
|
||||
return addr
|
||||
else:
|
||||
return sorted(base_map.keys(), key=lambda x:base_map[x])
|
||||
return sorted(list(base_map.keys()), key=lambda x:base_map[x])
|
||||
|
||||
def get_all_resident_pos(self):
|
||||
offs = self.get_all_matchwords()
|
||||
|
||||
@ -3,7 +3,7 @@ import struct
|
||||
|
||||
from amitools.binfmt.BinImage import *
|
||||
from amitools.binfmt.Relocate import *
|
||||
from KickRom import KickRomAccess
|
||||
from .KickRom import KickRomAccess
|
||||
|
||||
|
||||
class RomEntryRaw:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import logging
|
||||
from RomAccess import RomAccess
|
||||
from .RomAccess import RomAccess
|
||||
|
||||
|
||||
class RomPatch:
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
import fnmatch
|
||||
import struct
|
||||
|
||||
import KickRom
|
||||
import RemusFile
|
||||
from . import KickRom
|
||||
from . import RemusFile
|
||||
import amitools.util.DataDir as DataDir
|
||||
from amitools.binfmt.BinImage import *
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
"""Scan an ADF image an visit all files"""
|
||||
|
||||
import StringIO
|
||||
import io
|
||||
|
||||
from amitools.fs.blkdev.BlkDevFactory import BlkDevFactory
|
||||
from amitools.fs.ADFSVolume import ADFSVolume
|
||||
@ -50,7 +50,7 @@ class ADFSScanner:
|
||||
node.flush()
|
||||
size = len(data)
|
||||
path = node.get_node_path_name().get_unicode()
|
||||
fobj = StringIO.StringIO(data)
|
||||
fobj = io.StringIO(data)
|
||||
sf = scan_file.create_sub_path(path, fobj, size, True, False)
|
||||
ok = scanner.scan_obj(sf)
|
||||
sf.close()
|
||||
@ -59,17 +59,17 @@ class ADFSScanner:
|
||||
# mini test
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
from FileScanner import FileScanner
|
||||
from .FileScanner import FileScanner
|
||||
|
||||
ifs = ['*.txt']
|
||||
def handler(scan_file):
|
||||
print(scan_file)
|
||||
return True
|
||||
def skip_handler(scan_file):
|
||||
print("SKIP:", scan_file)
|
||||
print(("SKIP:", scan_file))
|
||||
return True
|
||||
def error_handler(scan_file, error):
|
||||
print("FAILED:", scan_file, error)
|
||||
print(("FAILED:", scan_file, error))
|
||||
raise error
|
||||
scanners = [ADFSScanner()]
|
||||
fs = FileScanner(handler, ignore_filters=ifs, error_handler=error_handler,
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
from __future__ import print_function
|
||||
|
||||
|
||||
import zipfile
|
||||
import StringIO
|
||||
import io
|
||||
|
||||
# optional lhafile
|
||||
try:
|
||||
@ -61,7 +61,7 @@ class ZipScanner(ArchiveScanner):
|
||||
fobj = sf.get_fobj()
|
||||
return zipfile.ZipFile(fobj, "r")
|
||||
except Exception as e:
|
||||
scanner.warn(sf, "error reading archive: %s" % e)
|
||||
scanner.warning(sf, "error reading archive: %s" % e)
|
||||
|
||||
def _create_entry_scan_file(self, arc, info, scan_file):
|
||||
name = info.filename
|
||||
@ -82,13 +82,13 @@ class LhaScanner(ArchiveScanner):
|
||||
fobj = sf.get_fobj()
|
||||
return lhafile.LhaFile(fobj, "r")
|
||||
except Exception as e:
|
||||
scanner.warn(sf, "error reading archive: %s" % e)
|
||||
scanner.warning(sf, "error reading archive: %s" % e)
|
||||
else:
|
||||
scanner.warn(sf, "can't handle archive. missing 'lhafile' module.")
|
||||
scanner.warning(sf, "can't handle archive. missing 'lhafile' module.")
|
||||
|
||||
def _create_entry_scan_file(self, arc, info, scan_file):
|
||||
data = arc.read(info.filename)
|
||||
fobj = StringIO.StringIO(data)
|
||||
fobj = io.StringIO(data)
|
||||
size = info.file_size
|
||||
name = info.filename
|
||||
return scan_file.create_sub_path(name, fobj, size, True, False)
|
||||
@ -97,7 +97,7 @@ class LhaScanner(ArchiveScanner):
|
||||
# mini test
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
from FileScanner import FileScanner
|
||||
from .FileScanner import FileScanner
|
||||
|
||||
ifs = ['*.txt']
|
||||
def handler(scan_file):
|
||||
|
||||
@ -1,12 +1,12 @@
|
||||
# scan a set of file
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
|
||||
import os
|
||||
import fnmatch
|
||||
import tempfile
|
||||
|
||||
from ScanFile import ScanFile
|
||||
from .ScanFile import ScanFile
|
||||
|
||||
class FileScanner:
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
from __future__ import print_function
|
||||
|
||||
|
||||
import os
|
||||
import StringIO
|
||||
import io
|
||||
|
||||
class ScanFile:
|
||||
"""a file that is currently scanned"""
|
||||
@ -69,7 +69,7 @@ class ScanFile:
|
||||
# create a string buffer
|
||||
else:
|
||||
data = src_fobj.read()
|
||||
fobj = StringIO.StringIO(data)
|
||||
fobj = io.StringIO(data)
|
||||
# close old scan file
|
||||
src_fobj.close()
|
||||
# create promoted file
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python2.7
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# fdtool <file.fd> ...
|
||||
#
|
||||
@ -12,13 +12,13 @@ import amitools.fd.FDFormat as FDFormat
|
||||
|
||||
def dump(fname, fd, add_private):
|
||||
print(fname)
|
||||
print(" base: %s" % fd.get_base_name())
|
||||
print((" base: %s" % fd.get_base_name()))
|
||||
funcs = fd.get_funcs()
|
||||
num = 1
|
||||
for f in funcs:
|
||||
if add_private or not f.is_private():
|
||||
bias = f.get_bias()
|
||||
print(" #%04d %5d 0x%04x %30s %s" % (num,bias,bias,f.get_name(),f.get_arg_str()))
|
||||
print((" #%04d %5d 0x%04x %30s %s" % (num,bias,bias,f.get_name(),f.get_arg_str())))
|
||||
num += 1
|
||||
|
||||
# ----- generate -----
|
||||
@ -32,7 +32,7 @@ def generate_python_code(fd, add_private):
|
||||
args = tuple(args)
|
||||
else:
|
||||
args = None
|
||||
print " (%d, '%s', %s)," % (f.get_bias(),f.get_name(),args)
|
||||
print(" (%d, '%s', %s)," % (f.get_bias(),f.get_name(),args))
|
||||
|
||||
def generate_sasc_code(fname, fd, add_private, prefix=""):
|
||||
funcs = fd.get_funcs()
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python2.7
|
||||
#!/usr/bin/env python3
|
||||
|
||||
|
||||
|
||||
from __future__ import absolute_import
|
||||
from __future__ import print_function
|
||||
|
||||
import sys
|
||||
import os.path
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python2.7
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# hunktool
|
||||
#
|
||||
@ -34,15 +34,15 @@ class HunkCommand:
|
||||
self.failed_files = []
|
||||
|
||||
def handle_file(self, path, hunk_file, error_code, delta):
|
||||
if not self.counts.has_key(error_code):
|
||||
if error_code not in self.counts:
|
||||
self.counts[error_code] = 0
|
||||
self.counts[error_code] += 1
|
||||
|
||||
print "%s (%.4fs)" % (path, delta),
|
||||
print("%s (%.4fs)" % (path, delta), end=' ')
|
||||
|
||||
# abort if hunk parser failed!
|
||||
if error_code != Hunk.RESULT_OK:
|
||||
print Hunk.result_names[error_code], hunk_file.error_string
|
||||
print(Hunk.result_names[error_code], hunk_file.error_string)
|
||||
if self.args.dump:
|
||||
print_pretty(hunk_file.hunks)
|
||||
self.failed_files.append( (path, "READ: " + hunk_file.error_string) )
|
||||
@ -50,43 +50,43 @@ class HunkCommand:
|
||||
|
||||
# if verbose then print block structure
|
||||
if self.args.verbose:
|
||||
print
|
||||
print " hunks: ",hunk_file.get_hunk_summary()
|
||||
print()
|
||||
print(" hunks: ",hunk_file.get_hunk_summary())
|
||||
if self.args.dump:
|
||||
print_pretty(hunk_file.hunks)
|
||||
print " type: ",
|
||||
print(" type: ", end=' ')
|
||||
|
||||
# build segments from hunks
|
||||
ok = hunk_file.build_segments()
|
||||
if not ok:
|
||||
print "BUILD SEGMENTS FAILED: %s" % (hunk_file.error_string)
|
||||
print("BUILD SEGMENTS FAILED: %s" % (hunk_file.error_string))
|
||||
self.failed_files.append( (path, "BUILD: " + hunk_file.error_string) )
|
||||
return not self.args.stop
|
||||
|
||||
# print recognized file type name
|
||||
print Hunk.type_names[hunk_file.type],
|
||||
print(Hunk.type_names[hunk_file.type], end=' ')
|
||||
|
||||
# if verbose then print hunk structure
|
||||
if self.args.verbose:
|
||||
print
|
||||
print " segments: ",hunk_file.get_segment_summary()
|
||||
print " overlays: ",hunk_file.get_overlay_segment_summary()
|
||||
print " libs: ",hunk_file.get_libs_summary()
|
||||
print " units: ",hunk_file.get_units_summary()
|
||||
print()
|
||||
print(" segments: ",hunk_file.get_segment_summary())
|
||||
print(" overlays: ",hunk_file.get_overlay_segment_summary())
|
||||
print(" libs: ",hunk_file.get_libs_summary())
|
||||
print(" units: ",hunk_file.get_units_summary())
|
||||
if self.args.dump:
|
||||
print_pretty(hunk_file.hunks)
|
||||
else:
|
||||
print
|
||||
print()
|
||||
|
||||
# do special processing on hunk file for command
|
||||
ok = self.handle_hunk_file(path, hunk_file)
|
||||
return ok
|
||||
|
||||
def result(self):
|
||||
for code in self.counts.keys():
|
||||
print Hunk.result_names[code],":",self.counts[code]
|
||||
for code in list(self.counts.keys()):
|
||||
print(Hunk.result_names[code],":",self.counts[code])
|
||||
for failed in self.failed_files:
|
||||
print failed[0],failed[1]
|
||||
print(failed[0],failed[1])
|
||||
return 0
|
||||
|
||||
def process_file(self, scan_file):
|
||||
@ -105,10 +105,10 @@ class HunkCommand:
|
||||
def run(self):
|
||||
# setup error handler
|
||||
def error_handler(sf, e):
|
||||
print "FAILED", sf.get_path(), e
|
||||
print("FAILED", sf.get_path(), e)
|
||||
return not self.args.stop
|
||||
def warning_handler(sf, msg):
|
||||
print "WARNING", sf.get_path(), msg
|
||||
print("WARNING", sf.get_path(), msg)
|
||||
# setup scanners
|
||||
scanners = [ADFSScanner(), ZipScanner(), LhaScanner()]
|
||||
scanner = FileScanner(self.process_file,
|
||||
@ -118,7 +118,7 @@ class HunkCommand:
|
||||
for path in self.args.files:
|
||||
ok = scanner.scan(path)
|
||||
if not ok:
|
||||
print "ABORTED"
|
||||
print("ABORTED")
|
||||
return False
|
||||
return True
|
||||
|
||||
@ -152,7 +152,7 @@ class Relocate(HunkCommand):
|
||||
|
||||
def handle_hunk_file(self, path, hunk_file):
|
||||
if hunk_file.type != Hunk.TYPE_LOADSEG:
|
||||
print "ERROR: can only relocate LoadSeg()able files:",path;
|
||||
print("ERROR: can only relocate LoadSeg()able files:",path);
|
||||
return False
|
||||
|
||||
rel = HunkRelocate.HunkRelocate(hunk_file,verbose=self.args.verbose)
|
||||
@ -164,14 +164,14 @@ class Relocate(HunkCommand):
|
||||
# relocate and return data of segments
|
||||
datas = rel.relocate(addrs)
|
||||
if datas == None:
|
||||
print "ERROR: relocation failed:",path
|
||||
print("ERROR: relocation failed:",path)
|
||||
return False
|
||||
else:
|
||||
print "Relocate to base address",base_addr
|
||||
print "Bases: "," ".join(map(lambda x:"%06x"%(x),addrs))
|
||||
print "Sizes: "," ".join(map(lambda x:"%06x"%(x),sizes))
|
||||
print "Data: "," ".join(map(lambda x:"%06x"%(len(x)),datas))
|
||||
print "Total: ","%06x"%(rel.get_total_size())
|
||||
print("Relocate to base address",base_addr)
|
||||
print("Bases: "," ".join(["%06x"%(x) for x in addrs]))
|
||||
print("Sizes: "," ".join(["%06x"%(x) for x in sizes]))
|
||||
print("Data: "," ".join(["%06x"%(len(x)) for x in datas]))
|
||||
print("Total: ","%06x"%(rel.get_total_size()))
|
||||
if args.hexdump:
|
||||
for d in datas:
|
||||
print_hex(d)
|
||||
@ -188,7 +188,7 @@ class ElfInfo:
|
||||
reader = amitools.binfmt.elf.ELFReader()
|
||||
elf = reader.load(open(f, "rb"))
|
||||
if elf is None:
|
||||
print "ERROR loading ELF:",elf.error_string
|
||||
print("ERROR loading ELF:",elf.error_string)
|
||||
return 1
|
||||
dumper = amitools.binfmt.elf.ELFDumper(elf)
|
||||
dumper.dump_sections(show_relocs=args.show_relocs, show_debug=args.show_debug)
|
||||
@ -207,7 +207,7 @@ def main():
|
||||
}
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('command', help="command: "+",".join(cmd_map.keys()))
|
||||
parser.add_argument('command', help="command: "+",".join(list(cmd_map.keys())))
|
||||
parser.add_argument('files', nargs='+')
|
||||
parser.add_argument('-d', '--dump', action='store_true', default=False, help="dump the hunk structure")
|
||||
parser.add_argument('-v', '--verbose', action='store_true', default=False, help="be more verbos")
|
||||
@ -224,11 +224,11 @@ def main():
|
||||
args = parser.parse_args()
|
||||
|
||||
cmd = args.command
|
||||
if not cmd_map.has_key(cmd):
|
||||
print "INVALID COMMAND:",cmd
|
||||
print "valid commands are:"
|
||||
if cmd not in cmd_map:
|
||||
print("INVALID COMMAND:",cmd)
|
||||
print("valid commands are:")
|
||||
for a in cmd_map:
|
||||
print " ",a
|
||||
print(" ",a)
|
||||
return 1
|
||||
cmd_cls = cmd_map[cmd]
|
||||
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
#!/usr/bin/env python2.7
|
||||
#!/usr/bin/env python3
|
||||
# rdbtool
|
||||
# swiss army knife for rdb disk images or devices
|
||||
|
||||
from __future__ import absolute_import
|
||||
from __future__ import print_function
|
||||
|
||||
|
||||
|
||||
import sys
|
||||
import argparse
|
||||
@ -256,7 +256,7 @@ class InitCommand(OpenCommand):
|
||||
def init_rdisk(self, blkdev):
|
||||
opts = KeyValue.parse_key_value_strings(self.opts)
|
||||
# number of cylinders for RDB
|
||||
if opts.has_key('rdb_cyls'):
|
||||
if 'rdb_cyls' in opts:
|
||||
rdb_cyls = int(opts['rdb_cyls'])
|
||||
else:
|
||||
rdb_cyls = 1
|
||||
@ -319,9 +319,9 @@ class PartEditCommand(Command):
|
||||
self.rdisk = rdisk
|
||||
|
||||
def get_dos_type(self, empty=False):
|
||||
if self.popts.has_key('fs'):
|
||||
if 'fs' in self.popts:
|
||||
fs_str = self.popts['fs']
|
||||
elif self.popts.has_key('dostype'):
|
||||
elif 'dostype' in self.popts:
|
||||
fs_str = self.popts['dostype']
|
||||
elif not empty:
|
||||
fs_str = self.args.dostype
|
||||
@ -330,7 +330,7 @@ class PartEditCommand(Command):
|
||||
return parse_dos_type_str(str(fs_str))
|
||||
|
||||
def get_drv_name(self, empty=False):
|
||||
if self.popts.has_key('name'):
|
||||
if 'name' in self.popts:
|
||||
drv_name = self.popts['name']
|
||||
elif empty:
|
||||
drv_name = None
|
||||
@ -339,7 +339,7 @@ class PartEditCommand(Command):
|
||||
return drv_name
|
||||
|
||||
def get_bootable(self, empty=False):
|
||||
if self.popts.has_key('bootable'):
|
||||
if 'bootable' in self.popts:
|
||||
return bool(self.popts['bootable'])
|
||||
elif not empty:
|
||||
return False
|
||||
@ -347,7 +347,7 @@ class PartEditCommand(Command):
|
||||
return None
|
||||
|
||||
def get_boot_pri(self, empty=False):
|
||||
if self.popts.has_key('pri'):
|
||||
if 'pri' in self.popts:
|
||||
return self.popts['pri']
|
||||
elif not empty:
|
||||
return 0
|
||||
@ -355,7 +355,7 @@ class PartEditCommand(Command):
|
||||
return None
|
||||
|
||||
def get_automount(self, empty=False):
|
||||
if self.popts.has_key('automount'):
|
||||
if 'automount' in self.popts:
|
||||
return bool(self.popts['automount'])
|
||||
elif not empty:
|
||||
return True
|
||||
@ -363,7 +363,7 @@ class PartEditCommand(Command):
|
||||
return None
|
||||
|
||||
def get_fs_block_size(self, empty=False):
|
||||
if self.popts.has_key('bs'):
|
||||
if 'bs' in self.popts:
|
||||
return int(self.popts['bs'])
|
||||
elif not empty:
|
||||
return 512
|
||||
@ -399,22 +399,22 @@ class PartEditCommand(Command):
|
||||
|
||||
def get_more_dos_env_info(self):
|
||||
valid_keys = PartitionDosEnv.valid_keys
|
||||
info = map(lambda x : "[%s=<n>]" % x, valid_keys)
|
||||
info = ["[%s=<n>]" % x for x in valid_keys]
|
||||
return " ".join(info)
|
||||
|
||||
def get_cyl_range(self):
|
||||
start = None
|
||||
if self.popts.has_key('start'):
|
||||
if 'start' in self.popts:
|
||||
start = int(self.popts['start'])
|
||||
# range with start=<n> end=<n>
|
||||
if self.popts.has_key('end'):
|
||||
if 'end' in self.popts:
|
||||
end = int(self.popts['end'])
|
||||
if start == None or end <= start:
|
||||
return None
|
||||
else:
|
||||
return (start, end)
|
||||
# expect a size
|
||||
elif self.popts.has_key('size'):
|
||||
elif 'size' in self.popts:
|
||||
size = self.popts['size']
|
||||
cyls = None
|
||||
if type(size) == int:
|
||||
@ -524,7 +524,7 @@ class ExportCommand(Command):
|
||||
(p.get_drive_name(), num_blks, file_name))
|
||||
try:
|
||||
with open(file_name, "wb") as fh:
|
||||
for b in xrange(num_blks):
|
||||
for b in range(num_blks):
|
||||
data = blkdev.read_block(b)
|
||||
fh.write(data)
|
||||
except IOError as e:
|
||||
@ -569,7 +569,7 @@ class ImportCommand(Command):
|
||||
(file_name, file_blks, p.get_drive_name(), part_blks))
|
||||
# copy image
|
||||
with open(file_name, "rb") as fh:
|
||||
for b in xrange(file_blks):
|
||||
for b in range(file_blks):
|
||||
data = fh.read(blk_size)
|
||||
part_dev.write_block(b, data)
|
||||
part_dev.close()
|
||||
@ -659,9 +659,9 @@ class FSAddCommand(Command):
|
||||
self.popts = KeyValue.parse_key_value_strings(self.opts)
|
||||
|
||||
def get_dos_type(self):
|
||||
if self.popts.has_key('fs'):
|
||||
if 'fs' in self.popts:
|
||||
fs_str = self.popts['fs']
|
||||
elif self.popts.has_key('dostype'):
|
||||
elif 'dostype' in self.popts:
|
||||
fs_str = self.popts['dostype']
|
||||
else:
|
||||
fs_str = self.args.dostype
|
||||
@ -671,7 +671,7 @@ class FSAddCommand(Command):
|
||||
self.parse_opts()
|
||||
valid_flags = FSHeaderDeviceNode.valid_flags
|
||||
if len(self.opts) < 1:
|
||||
flag_info = map(lambda x : "[%s=<n>]" % x, valid_flags)
|
||||
flag_info = ["[%s=<n>]" % x for x in valid_flags]
|
||||
flag_info = " ".join(flag_info)
|
||||
print("Usage: fsadd <file_name> [dostype=<n|tag>] [version=<n.m>] " + flag_info)
|
||||
return 1
|
||||
@ -691,7 +691,7 @@ class FSAddCommand(Command):
|
||||
if ver == None:
|
||||
ver = (0,0)
|
||||
# overwrite version from options
|
||||
if opts.has_key('version'):
|
||||
if 'version' in opts:
|
||||
vstr = opts['version']
|
||||
pos = vstr.find('.')
|
||||
if pos != -1:
|
||||
@ -782,7 +782,7 @@ def main():
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('image_file')
|
||||
parser.add_argument('command_list', nargs='+', help="command: "+",".join(cmd_map.keys()))
|
||||
parser.add_argument('command_list', nargs='+', help="command: "+",".join(list(cmd_map.keys())))
|
||||
parser.add_argument('-v', '--verbose', action='store_true', default=False, help="be more verbos")
|
||||
parser.add_argument('-s', '--seperator', default='+', help="set the command separator char sequence")
|
||||
parser.add_argument('-r', '--read-only', action='store_true', default=False, help="read-only operation")
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
#!/usr/bin/env python2.7
|
||||
#!/usr/bin/env python3
|
||||
# romtool
|
||||
#
|
||||
# work with Amiga ROM files aka Kickstarts
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
|
||||
import sys
|
||||
import argparse
|
||||
@ -100,7 +100,7 @@ def do_build_cmd(args):
|
||||
fill_byte = int(args.fill_byte, 16)
|
||||
rom_rev = args.rom_rev
|
||||
if rom_rev is not None:
|
||||
rom_rev = map(int, rom_rev.split("."))
|
||||
rom_rev = list(map(int, rom_rev.split(".")))
|
||||
add_footer = args.add_footer
|
||||
# select rom builder
|
||||
if rom_type == 'kick':
|
||||
@ -270,7 +270,7 @@ def do_info_cmd(args):
|
||||
('magic_reset', kh.check_magic_reset()),
|
||||
('is_kick', kh.is_kick_rom())
|
||||
]
|
||||
c = map(lambda x:"%-20s %s" % (x[0], "ok" if x[1] else "NOK"), checks)
|
||||
c = ["%-20s %s" % (x[0], "ok" if x[1] else "NOK") for x in checks]
|
||||
for i in c:
|
||||
print(i)
|
||||
values = [
|
||||
@ -280,7 +280,7 @@ def do_info_cmd(args):
|
||||
('rom_rev', '%d.%d', kh.read_rom_ver_rev()),
|
||||
('exec_rev', '%d.%d', kh.read_exec_ver_rev())
|
||||
]
|
||||
v = map(lambda x:"%-20s %s" % (x[0], x[1] % x[2]), values)
|
||||
v = ["%-20s %s" % (x[0], x[1] % x[2]) for x in values]
|
||||
for i in v:
|
||||
print(i)
|
||||
|
||||
@ -387,7 +387,7 @@ def do_scan_cmd(args):
|
||||
logging.error("can't guess base address of ROM!")
|
||||
return 1
|
||||
elif type(base_addr) is list:
|
||||
addrs = map(hex, base_addr)
|
||||
addrs = list(map(hex, base_addr))
|
||||
logging.error("multiple addresses guessed: %s", ",".join(addrs))
|
||||
return 2
|
||||
else:
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python2.7
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# typetool [options] <path>
|
||||
#
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python2.7
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# vamos [optoins] <amiga binary> [args ...]
|
||||
#
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python2.7
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# vamospath [options] <path>
|
||||
#
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python2.7
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# vamostool
|
||||
#
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
#!/usr/bin/env python2.7
|
||||
#!/usr/bin/env python3
|
||||
# xdfscan
|
||||
# quickly scan large sets of Amiga disk image files
|
||||
|
||||
from __future__ import absolute_import
|
||||
from __future__ import print_function
|
||||
|
||||
|
||||
|
||||
import sys
|
||||
import argparse
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
#!/usr/bin/env python2.7
|
||||
#!/usr/bin/env python3
|
||||
# xdftool
|
||||
# swiss army knife for adf and hdf amiga disk images
|
||||
|
||||
from __future__ import absolute_import
|
||||
from __future__ import print_function
|
||||
|
||||
|
||||
|
||||
import sys
|
||||
import argparse
|
||||
@ -819,7 +819,7 @@ def main():
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('image_file')
|
||||
parser.add_argument('command_list', nargs='+', help="command: "+",".join(cmd_map.keys()))
|
||||
parser.add_argument('command_list', nargs='+', help="command: "+",".join(list(cmd_map.keys())))
|
||||
parser.add_argument('-v', '--verbose', action='store_true', default=False, help="be more verbos")
|
||||
parser.add_argument('-s', '--seperator', default='+', help="set the command separator char sequence")
|
||||
parser.add_argument('-r', '--read-only', action='store_true', default=False, help="read-only operation")
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
#!/usr/bin/env python2.7
|
||||
#!/usr/bin/env python3
|
||||
# based heavily on "iops" by Benjamin Schweizer
|
||||
# https://github.com/gopher/iops
|
||||
|
||||
from __future__ import absolute_import
|
||||
from __future__ import print_function
|
||||
|
||||
|
||||
|
||||
import sys
|
||||
import array
|
||||
@ -20,10 +20,10 @@ def getblkdevsize(dev):
|
||||
DKIOCGETBLOCKCOUNT = 0x40086419 # _IOR('d', 25, uint64_t)
|
||||
|
||||
fh = open(dev, 'r')
|
||||
buf = array.array('B', range(0,4)) # uint32
|
||||
buf = array.array('B', list(range(0,4))) # uint32
|
||||
r = fcntl.ioctl(fh.fileno(), DKIOCGETBLOCKSIZE, buf, 1)
|
||||
blocksize = struct.unpack('I', buf)[0]
|
||||
buf = array.array('B', range(0,8)) # uint64
|
||||
buf = array.array('B', list(range(0,8))) # uint64
|
||||
r = fcntl.ioctl(fh.fileno(), DKIOCGETBLOCKCOUNT, buf, 1)
|
||||
blockcount = struct.unpack('Q', buf)[0]
|
||||
fh.close()
|
||||
@ -35,7 +35,7 @@ def getblkdevsize(dev):
|
||||
DIOCGMEDIASIZE = 0x40086481 # _IOR('d', 129, uint64_t)
|
||||
|
||||
fh = open(dev, 'r')
|
||||
buf = array.array('B', range(0,8)) # off_t / int64
|
||||
buf = array.array('B', list(range(0,8))) # off_t / int64
|
||||
r = fcntl.ioctl(fh.fileno(), DIOCGMEDIASIZE, buf, 1)
|
||||
size = struct.unpack('q', buf)[0]
|
||||
fh.close()
|
||||
|
||||
@ -55,7 +55,7 @@ def parse_byte_size_str(s):
|
||||
unit = 1000
|
||||
# check for scale
|
||||
scale = s[-1]
|
||||
if scale in scale_map.keys():
|
||||
if scale in list(scale_map.keys()):
|
||||
factor = unit ** scale_map[scale]
|
||||
if n == 1:
|
||||
return None
|
||||
@ -76,7 +76,7 @@ if __name__ == '__main__':
|
||||
for a in sys.argv[1:]:
|
||||
v = parse_byte_size_str(a)
|
||||
if v != None:
|
||||
print(a, ":", v, "=", to_byte_size_str(v), "=", to_byte_size_str(v, False))
|
||||
print((a, ":", v, "=", to_byte_size_str(v), "=", to_byte_size_str(v, False)))
|
||||
else:
|
||||
print(a, ":", v)
|
||||
print((a, ":", v))
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
from __future__ import absolute_import
|
||||
from __future__ import print_function
|
||||
|
||||
|
||||
|
||||
class CommandQueue:
|
||||
def __init__(self, cmd_list, sep, cmd_map):
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
# DataDir.py - return location of my data directory
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
|
||||
import os.path
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user