diff --git a/bin/build b/bin/build index d550279..f3f1a04 100755 --- a/bin/build +++ b/bin/build @@ -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()) diff --git a/bin/splice.py b/bin/splice.py index 774406a..316349c 100644 --- a/bin/splice.py +++ b/bin/splice.py @@ -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)