python2: nicer page, group by base
This commit is contained in:
28
main.py
28
main.py
@@ -1171,11 +1171,11 @@ def test() -> RouteResponse:
|
||||
def is_split_package(p: Package) -> bool:
|
||||
c = 0
|
||||
for name, type_ in p.makedepends:
|
||||
if name == "mingw-w64-x86_64-python3":
|
||||
if name.startswith("mingw-w64-x86_64-python3"):
|
||||
c += 1
|
||||
if name == "mingw-w64-x86_64-python2":
|
||||
if name.startswith("mingw-w64-x86_64-python2"):
|
||||
c += 1
|
||||
if c == 2:
|
||||
if c >= 2:
|
||||
return True
|
||||
return False
|
||||
|
||||
@@ -1190,21 +1190,27 @@ def test() -> RouteResponse:
|
||||
todo[rdep.name] = rdep
|
||||
return len(done) - 1
|
||||
|
||||
result = "<ul>"
|
||||
deps = []
|
||||
for s in state.sources:
|
||||
for p in s.packages.values():
|
||||
if p.name.endswith("-x86_64-python2"):
|
||||
for rdep in sorted(set([x[0] for x in p.rdepends]), key=lambda y: y.name):
|
||||
if is_split_package(rdep) and "-python2-" not in rdep.name:
|
||||
continue
|
||||
deps.append((get_rdep_count(rdep), rdep))
|
||||
deps.append((rdep, get_rdep_count(rdep), is_split_package(rdep)))
|
||||
break
|
||||
|
||||
for c, d in sorted(deps, key=lambda i: (i[0], i[1].name)):
|
||||
result += "<li>" + d.name + " / %d" % c + "</li>"
|
||||
grouped: Dict[str, Tuple[int, bool]] = {}
|
||||
for p, count, split in deps:
|
||||
base = p.base
|
||||
if base in grouped:
|
||||
old_count, old_split = grouped[base]
|
||||
grouped[base] = (old_count + count, split or old_split)
|
||||
else:
|
||||
grouped[base] = (count, split)
|
||||
|
||||
result += "</ul>"
|
||||
return result
|
||||
results = sorted(grouped.items(), key=lambda i: (i[1][0], i[0]))
|
||||
|
||||
return render_template(
|
||||
'python2.html', results=results)
|
||||
|
||||
|
||||
@packages.route('/search')
|
||||
|
||||
32
templates/python2.html
Normal file
32
templates/python2.html
Normal file
@@ -0,0 +1,32 @@
|
||||
{% extends "layout.html" %}
|
||||
{% block title %}Python 2 Removal TODOs{% endblock %}
|
||||
{% block inner_content %}
|
||||
|
||||
<div class="card mb-3">
|
||||
<div class="card-header">
|
||||
<h4 class="card-title">Python 2 Removal TODOs</h4>
|
||||
<h6 class="card-subtitle mb-2 text-muted">{{ results|length }} packages to go</h6>
|
||||
</div>
|
||||
<div class="card-body overflow-auto">
|
||||
<table class="table table-hover table-sm">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Base</th>
|
||||
<th>Transitive Reverse Dependencies</th>
|
||||
<th>Dual Python Package</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for s, info in results %}
|
||||
<tr>
|
||||
<td><a href="{{ url_for('.base', name=s) }}">{{ s }}</a></td>
|
||||
<td>{{ info[0] }}</td>
|
||||
<td>{{ '✓' if info[1] else ''}}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user