mirror of
https://github.com/gryf/uc1541.git
synced 2026-01-30 18:15:45 +01:00
Clean up the code.
There was an issue regarding c1541 in old version - during removal of the file from the image, as a success message 'ERRORCODE 1' was placed on the stdout. If there was an issue with the file different message was placed also on stdout. Luckily, that weird behaviour was fixed in 3.x series of the Vice. So now we can remove unnecessary code. Also, fixed two bugs for pyton3, introduced during new formats development.
This commit is contained in:
25
uc1541
25
uc1541
@@ -102,7 +102,7 @@ def _get_implementation(disk):
|
|||||||
196608: D64, # 40 track, no errors
|
196608: D64, # 40 track, no errors
|
||||||
197376: D64} # 40 track, 768 error bytes
|
197376: D64} # 40 track, 768 error bytes
|
||||||
|
|
||||||
if disk[:32].startswith('C64'):
|
if disk[:32].startswith(b'C64'):
|
||||||
return # T64
|
return # T64
|
||||||
|
|
||||||
return len_map.get(len(disk))(disk)
|
return len_map.get(len(disk))(disk)
|
||||||
@@ -434,14 +434,6 @@ class Uc1541(object):
|
|||||||
if not self._call_command('delete', dst=dst):
|
if not self._call_command('delete', dst=dst):
|
||||||
return self._show_error()
|
return self._show_error()
|
||||||
|
|
||||||
# During removing, a message containing ERRORCODE is sent to stdout
|
|
||||||
# instead of stderr. Everything other than 'ERRORCODE 1' (which means:
|
|
||||||
# 'everything fine') is actually a failure. In case of verbose error
|
|
||||||
# output it is needed to copy self.out to self.err.
|
|
||||||
if '\nERRORCODE 1\n' not in self.out:
|
|
||||||
self.err = self.out
|
|
||||||
return self._show_error()
|
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
def copyin(self, dst, src):
|
def copyin(self, dst, src):
|
||||||
@@ -594,14 +586,19 @@ class Uc1541(object):
|
|||||||
command.append(dst)
|
command.append(dst)
|
||||||
|
|
||||||
LOG.debug('executing command: %s', ' '.join(command))
|
LOG.debug('executing command: %s', ' '.join(command))
|
||||||
# For some reason using write command and reading output confuses
|
# For some reason using write and delete commands and reading output
|
||||||
# Python3 beneath MC and as a consequence MC report an error...
|
# confuses Python3 beneath MC and as a consequence MC report an
|
||||||
# therefore for write command let's not use universal_newlines...
|
# error...therefore for those commands let's not use
|
||||||
|
# universal_newlines...
|
||||||
|
universal_newlines = True
|
||||||
|
if cmd in ['delete', 'write']:
|
||||||
|
universal_newlines = False
|
||||||
self.out, self.err = Popen(command,
|
self.out, self.err = Popen(command,
|
||||||
universal_newlines=(cmd != 'write'),
|
universal_newlines=universal_newlines,
|
||||||
stdout=PIPE, stderr=PIPE).communicate()
|
stdout=PIPE, stderr=PIPE).communicate()
|
||||||
|
|
||||||
LOG.debug('an err: %s', self.err)
|
if self.err:
|
||||||
|
LOG.debug('an err: %s', self.err)
|
||||||
return not self.err
|
return not self.err
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user