diff --git a/biostools/extractors.py b/biostools/extractors.py index 0f6ed7e..8b5899b 100644 --- a/biostools/extractors.py +++ b/biostools/extractors.py @@ -2156,7 +2156,7 @@ class VMExtractor(ArchiveExtractor): # Check for other dependencies. self._dep_dir = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(util.__file__))), 'vm') - for dep in ('floppy.144', 'freedos.img', 'INSTL2O.EXE'): + for dep in ('floppy.144', 'freedos.img'): if not os.path.exists(os.path.join(self._dep_dir, dep)): self._qemu_path = None break @@ -2199,6 +2199,7 @@ class VMExtractor(ArchiveExtractor): if not dep_src: continue + # Copy file. try: shutil.copy2(dep_src, os.path.join(dest_dir, dep_dest)) except: @@ -2209,7 +2210,6 @@ class VMExtractor(ArchiveExtractor): return False # Build QEMU arguments. - dest_dir_sanitized = dest_dir.replace(',', ',,') args = [self._qemu_path, '-m', '32', '-display', 'none', '-vga', 'none', '-boot', boot] for drive, drive_snapshot, drive_if in ((floppy, floppy_snapshot, 'floppy'), (hdd, hdd_snapshot, 'ide')): # Don't add this drive if an image was not specified. @@ -2225,24 +2225,32 @@ class VMExtractor(ArchiveExtractor): args += ['-drive', 'if=' + drive_if + ',snapshot=' + (drive_snapshot and 'on' or 'off') + ',format=raw,file=' + drive.replace(',', ',,')] if vvfat: # Add vvfat if requested. - args += ['-drive', 'if=ide,driver=vvfat,rw=on,dir=' + dest_dir_sanitized] # regular vvfat syntax can't handle : in path + args += ['-drive', 'if=ide,driver=vvfat,rw=on,dir=' + dest_dir.replace(',', ',,')] # regular vvfat syntax can't handle : in path # Run QEMU. - import time try: subprocess.run(args, timeout=60, input=None, stdout=self._devnull, stderr=subprocess.STDOUT, cwd=dest_dir) except: pass - # Remove dependencies, except for the floppy image if present. + # Remove dependency files. for i in range(len(deps)): + # Don't remove persistent disk images. if (not floppy_snapshot and deps[i][1] == floppy) or (not hdd_snapshot and deps[i][1] == hdd): continue + + # Remove file. try: os.remove(os.path.join(dest_dir, deps[i][1])) except: pass + # Just in case, we're working with DOS after all. + try: + os.remove(os.path.join(dest_dir, deps[i][1].upper())) + except: + pass + return True def _extract_floppy(self, file_path, file_header, dest_dir, dest_dir_0, *, match): @@ -2295,10 +2303,12 @@ class VMExtractor(ArchiveExtractor): """Extract Evergreen ETI files.""" # Establish dependencies. - deps = ( - (os.path.join(self._dep_dir, 'INSTL2O.EXE'), 'INSTL2O.EXE'), - (None, 'TARGET.BAT') - ) + deps = [ + (None, 'target.bat'), + (None, 'contact.eti'), + (None, 'contact.txt'), + (None, 'prevlang.dat') + ] # Read ETI header. in_f = open(file_path, 'rb') @@ -2314,11 +2324,11 @@ class VMExtractor(ArchiveExtractor): ctime = 0 # Start the extraction batch file. - bat_f = open(os.path.join(dest_dir, 'TARGET.BAT'), 'wb') - bat_f.write(b'D:\r\n') + bat_f = open(os.path.join(dest_dir, 'target.bat'), 'wb') + bat_f.write(b'd:\r\n') # Extract files into individual ETIs. - etis = [] + eti_index = 0 while True: # Parse file header. fn = in_f.read(12) # filename @@ -2334,16 +2344,17 @@ class VMExtractor(ArchiveExtractor): size = struct.unpack('