Reduce console spam

This commit is contained in:
Elliot Nunn 2019-12-21 05:59:27 +08:00
parent 1f6879c5d5
commit 7627be1e6d
2 changed files with 11 additions and 18 deletions

View File

@ -56,8 +56,6 @@ else:
########################################################################
print('Copying source', flush=True)
try:
shutil.rmtree(config.tmpdir)
except FileNotFoundError:
@ -104,8 +102,6 @@ for mkfile in all_makefiles:
########################################################################
print('Splicing amphibian DNA', flush=True) # Ugly, but keeps src tree clean
splice(config.tmpdir)
########################################################################
@ -117,8 +113,6 @@ vol['Src'].read_folder(config.tmpdir, date=0x90000000, mpw_dates=True)
########################################################################
print('Making bootable', flush=True)
def folder(name):
return path.join(path.dirname(path.abspath(__file__)), name)
@ -154,8 +148,8 @@ vol['MPW']['MPW Shell'].rsrc = macresources.make_file(mpw)
# which it normally does when the startup app isn't a 'FNDR'.
# At that point, replace ShutDwnUserChoice() with ShutDwnPower().
# Also, follow a special path to the startup app, instead of Finder name global.
sys = list(macresources.parse_file(vol['System Folder']['System'].rsrc))
for resource in sys:
system = list(macresources.parse_file(vol['System Folder']['System'].rsrc))
for resource in system:
if resource.type != b'scod': continue # "System CODE" resources = Process Mgr
resource.data = resource.data.replace(b'FNDR', b'LUSR')
@ -175,7 +169,7 @@ for resource in sys:
data[offset:offset+2] = b'\x48\x7A' # ...replace with PC-relative 'PEA startapp'
data[offset+2:offset+4] = (str_offset - (offset+2)).to_bytes(2, byteorder='big')
resource.data = bytes(data)
vol['System Folder']['System'].rsrc = macresources.make_file(sys)
vol['System Folder']['System'].rsrc = macresources.make_file(system)
# Patch the Finder to give it a Quit menu item
finder = list(macresources.parse_file(vol['System Folder']['Finder'].rsrc))
@ -190,18 +184,19 @@ vol['System Folder']['Finder'].rsrc = macresources.make_file(finder)
########################################################################
print('Creating HFS disk image')
with open(config.hfsimg, 'wb') as f:
f.write(vol.write(256*1024*1024, align=4096, desktopdb=False))
print('Starting Mini vMac...', flush=True)
ran = subprocess.run(config.vmac + ' ' + shlex.quote(config.hfsimg), shell=True, capture_output=True)
subprocess.run(config.vmac + ' ' + shlex.quote(config.hfsimg), shell=True, check=True)
# Some emulators print nonsense
if ran.returncode != 0:
sys.stdout.buffer.write(ran.stdout)
sys.stderr.buffer.write(ran.stderr)
sys.exit(ran.returncode)
########################################################################
print('Saving changes and cleaning up', flush=True)
vol = machfs.Volume()
with open(config.hfsimg, 'rb') as f:
vol.read(f.read())

View File

@ -1,4 +1,3 @@
import argparse
import glob
import re
import os
@ -90,6 +89,5 @@ def splice(directory):
fd.write(' ƒ {Sources}%s:%s\n' % (OVERDIR, orig_name))
fd.write('\tDuplicate -y {Deps} {Targ}\n')
diag = 'Successfully spliced: %d/%d' % (len(overs)-len(remaining), len(overs))
if remaining: diag += '; Failed: ' + ' '.join(remaining)
print(diag)
if remaining:
print('Failed to splice:', *remaining)