~rbalint/merge-o-matic/merge-o-matic-comment

« back to all changes in this revision

Viewing changes to momlib.py

  • Committer: Colin Watson
  • Date: 2016-11-13 02:28:23 UTC
  • Revision ID: cjwatson@canonical.com-20161113022823-f20tapeibdxd4r11
Use new-style except and raise syntax.

Show diffs side-by-side

added added

removed removed

Lines of Context:
170
170
    while dirname != ROOT:
171
171
        try:
172
172
            os.rmdir(dirname)
173
 
        except OSError, e:
 
173
        except OSError as e:
174
174
            if e.errno == errno.ENOTEMPTY or e.errno == errno.ENOENT:
175
175
                break
176
176
            raise
457
457
        except IndexError:
458
458
            pass
459
459
    else:
460
 
        raise IndexError, "%s not found in %s %s" % (package, distro, dist)
 
460
        raise IndexError("%s not found in %s %s" % (package, distro, dist))
461
461
 
462
462
 
463
463
# --------------------------------------------------------------------------- #
566
566
            dsc_file = name
567
567
            break
568
568
    else:
569
 
        raise ValueError, "Missing dsc file"
 
569
        raise ValueError("Missing dsc file")
570
570
 
571
571
    ensure(destdir)
572
572
    try:
637
637
    """Read the report to determine the versions that went into it."""
638
638
    filename = "%s/REPORT" % output_dir
639
639
    if not os.path.isfile(filename):
640
 
        raise ValueError, "No report exists"
 
640
        raise ValueError("No report exists")
641
641
 
642
642
    base_version = None
643
643
    left_version = None
653
653
                right_version = Version(line[len(right_distro)+1:].strip())
654
654
 
655
655
    if base_version is None or left_version is None or right_version is None:
656
 
        raise AttributeError, "Insufficient detail in report"
 
656
        raise AttributeError("Insufficient detail in report")
657
657
 
658
658
    return (base_version, left_version, right_version)
659
659