[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[Git][ftp-team/dak][master] tools/rm822.py: switch to Python 3



Title: GitLab

Ansgar pushed to branch master at Debian FTP Team / dak

Commits:

1 changed file:

Changes:

  • tools/rm822.py
    1
    -#!/usr/bin/python
    
    1
    +#!/usr/bin/python3
    
    2 2
     # (c) 2010 Luca Falavigna <dktrkranz@debian.org>
    
    3 3
     # Free software licensed under the GPL version 2 or later
    
    4 4
     
    
    5
    -from __future__ import print_function
    
    6
    -
    
    7 5
     import re
    
    8 6
     from sys import argv
    
    9 7
     
    
    10 8
     if len(argv) < 2:
    
    11 9
         print('Usage:\t./%s removal-file' % argv[0])
    
    12 10
         exit()
    
    13
    -fd = open(argv[1], 'r')
    
    14
    -data = fd.read()
    
    15
    -fd.close()
    
    11
    +with open(argv[1]) as fh:
    
    12
    +    data = fh.read()
    
    16 13
     removals = re.split('=\n=', data)
    
    17 14
     for removal in removals:
    
    18 15
         removal = re.sub('\n\n', '\n', removal)
    
    ... ... @@ -22,9 +19,9 @@ for removal in removals:
    22 19
         packages = re.split(r'from [\S\s]+:\n', removal)[1].split('\n---')[0]
    
    23 20
         reason = re.split('---\n', removal)[1].split('\n---')[0]
    
    24 21
         bug = re.search(r'Closed bugs: (\d+)', removal)
    
    25
    -    print('Date: %s' % date)
    
    26
    -    print('Ftpmaster: %s' % ftpmaster)
    
    27
    -    print('Suite: %s' % suite)
    
    22
    +    print(f'Date: {date}')
    
    23
    +    print(f'Ftpmaster: {ftpmaster}')
    
    24
    +    print(f'Suite: {suite}')
    
    28 25
         sources = []
    
    29 26
         binaries = []
    
    30 27
         for package in packages.split('\n'):
    
    ... ... @@ -37,14 +34,10 @@ for removal in removals:
    37 34
                     if element[2]:
    
    38 35
                         binaries.append(' %s_%s [%s]' % tuple(elem.strip(' ') for elem in element))
    
    39 36
         if sources:
    
    40
    -        print('Sources:')
    
    41
    -        for source in sources:
    
    42
    -            print(source)
    
    37
    +        print('Sources:', *sources, sep='\n')
    
    43 38
         if binaries:
    
    44
    -        print('Binaries:')
    
    45
    -        for binary in binaries:
    
    46
    -            print(binary)
    
    47
    -    print('Reason: %s' % reason.replace('\n', '\n '))
    
    39
    +        print('Binaries:', *binaries, sep='\n')
    
    40
    +    print('Reason: {}'.format(reason.replace('\n', '\n ')))
    
    48 41
         if bug:
    
    49
    -        print('Bug: %s' % bug.group(1))
    
    42
    +        print(f'Bug: {bug.group(1)}')
    
    50 43
         print()


  • Reply to: