debian/patches/features/all/rt/genpatch.py: Catch more specific exception class

Now that we use Python 3, we can simply catch FileNotFoundError
instead of checking the IOError error code.
This commit is contained in:
Ben Hutchings 2016-12-08 19:25:12 +00:00
parent 465cba954c
commit 9287597ec2
1 changed files with 4 additions and 6 deletions

View File

@ -15,9 +15,8 @@ def main(source, version=None):
name = line.strip()
if name != '' and name[0] != '#':
old_series.add(name)
except IOError as e:
if e.errno != errno.ENOENT:
raise
except FileNotFoundError:
pass
with open(os.path.join(patch_dir, series_name), 'w') as series_fh:
# Add directory prefix to all filenames.
@ -27,9 +26,8 @@ def main(source, version=None):
path = os.path.join(patch_dir, name)
try:
os.unlink(path)
except OSError as e:
if e.errno != errno.ENOENT:
raise
except FileNotFoundError:
pass
with open(path, 'w') as patch:
in_header = True
for line in source_patch: