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:
parent
465cba954c
commit
9287597ec2
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue