Richard Pospesel pushed to branch main at The Tor Project / Applications / tor-browser-build

Commits:

1 changed file:

Changes:

  • tools/fetch-changelogs.py
    ... ... @@ -48,6 +48,7 @@ class Issue:
    48 48
             if not self.platform:
    
    49 49
                 self.platform = Platform.ALL_PLATFORMS
    
    50 50
                 self.num_platforms = 4
    
    51
    +        self.is_build = "Build System" in j["labels"]
    
    51 52
     
    
    52 53
         def get_platforms(self):
    
    53 54
             if self.platform == Platform.ALL_PLATFORMS:
    
    ... ... @@ -70,6 +71,15 @@ class Issue:
    70 71
             return self.number < other.number
    
    71 72
     
    
    72 73
     
    
    74
    +def sorted_issues(issues):
    
    75
    +    issues = [sorted(v) for v in issues.values()]
    
    76
    +    return sorted(
    
    77
    +        issues,
    
    78
    +        key=lambda group: (group[0].num_platforms << 8) | group[0].platform,
    
    79
    +        reverse=True,
    
    80
    +    )
    
    81
    +
    
    82
    +
    
    73 83
     if len(sys.argv) < 2:
    
    74 84
         print(f"Usage: {sys.argv[0]} version-to-release or #issue-id")
    
    75 85
         sys.exit(1)
    
    ... ... @@ -117,24 +127,28 @@ else:
    117 127
         version = "????"
    
    118 128
         iid = sys.argv[1][1:]
    
    119 129
     
    
    130
    +linked = {}
    
    131
    +linked_build = {}
    
    120 132
     r = requests.get(
    
    121 133
         f"{API_URL}/projects/{PROJECT_ID}/issues/{iid}/links", headers=headers
    
    122 134
     )
    
    123
    -linked = {}
    
    124 135
     for i in r.json():
    
    125 136
         i = Issue(i)
    
    126
    -    if i.platform not in linked:
    
    127
    -        linked[i.platform] = []
    
    128
    -    linked[i.platform].append(i)
    
    129
    -linked = sorted(
    
    130
    -    linked.values(),
    
    131
    -    key=lambda issues: (issues[0].num_platforms << 8) | issues[0].platform,
    
    132
    -    reverse=True,
    
    133
    -)
    
    137
    +    target = linked_build if i.is_build else linked
    
    138
    +    if i.platform not in target:
    
    139
    +        target[i.platform] = []
    
    140
    +    target[i.platform].append(i)
    
    141
    +linked = sorted_issues(linked)
    
    142
    +linked_build = sorted_issues(linked_build)
    
    134 143
     
    
    135 144
     date = datetime.now().strftime("%B %d %Y")
    
    136 145
     print(f"Tor Browser {version} - {date}")
    
    137 146
     for issues in linked:
    
    138 147
         print(f" * {issues[0].get_platforms()}")
    
    139
    -    for i in sorted(issues):
    
    148
    +    for i in issues:
    
    140 149
             print(f"   * {i}")
    
    150
    +print(" * Build System")
    
    151
    +for issues in linked_build:
    
    152
    +    print(f"   * {issues[0].get_platforms()}")
    
    153
    +    for i in issues:
    
    154
    +        print(f"     * {i}")