Commit a30d79b9 authored by Laurent Peuch's avatar Laurent Peuch
Browse files

feat(deprecated): exclude but list projects with outdated CW dependencies

parent 341ecbf9d507
Pipeline #24984 passed with stages
in 4 minutes and 45 seconds
...@@ -5,6 +5,8 @@ import gitlab ...@@ -5,6 +5,8 @@ import gitlab
import jinja2 import jinja2
import zipfile import zipfile
from heptalab import get_all_versions_number_from_pypi
from collections import defaultdict from collections import defaultdict
from rdflib import ConjunctiveGraph from rdflib import ConjunctiveGraph
...@@ -189,8 +191,23 @@ result: dict = defaultdict(lambda: {"count": 0, "path": [], ...@@ -189,8 +191,23 @@ result: dict = defaultdict(lambda: {"count": 0, "path": [],
"dependencies": {}, "dependencies": {},
"warnings": {}})}) "warnings": {}})})
outdated_projects = []
cubicweb_latest_version = get_all_versions_number_from_pypi("cubicweb")[-1]
# yams_latest_version = get_all_versions_number_from_pypi("yams")[-1]
# rql_latest_version = get_all_versions_number_from_pypi("rql")[-1]
# logilab_common_latest_version = get_all_versions_number_from_pypi("logilab-common")[-1]
# logilab_database_latest_version = get_all_versions_number_from_pypi("logilab-database")[-1]
for gitlab_project, warnings in all_artifacts.items(): for gitlab_project, warnings in all_artifacts.items():
for warning in warnings: for warning in warnings:
if "cubicweb" in warning.get("dependencies", ()):
current_project_cubicweb_version = tuple(map(int, warning["dependencies"]["cubicweb"].split(".")))
if current_project_cubicweb_version != cubicweb_latest_version:
if (gitlab_project, warning["dependencies"]) not in outdated_projects:
outdated_projects.append((gitlab_project, warning["dependencies"]))
continue
warning_text = eval(warning["args"])[0] warning_text = eval(warning["args"])[0]
result[warning_text]["count"] += warning["count"] result[warning_text]["count"] += warning["count"]
result[warning_text]["projects"][gitlab_project]["count"] += warning["count"] result[warning_text]["projects"][gitlab_project]["count"] += warning["count"]
...@@ -225,9 +242,11 @@ result = sorted(result.items(), key=lambda x: -x[1]["count"]) ...@@ -225,9 +242,11 @@ result = sorted(result.items(), key=lambda x: -x[1]["count"])
rendered_template = jinja2.Template(open("template/deprecated-warnings.html", rendered_template = jinja2.Template(open("template/deprecated-warnings.html",
"r").read()).render(warnings=result, "r").read()).render(warnings=result,
outdated_projects=outdated_projects,
cubicweb_latest_version=cubicweb_latest_version,
files_to_url=files_to_url_cache, files_to_url=files_to_url_cache,
highlight_code=highlight_code, highlight_code=highlight_code,
str=str, str=str, map=map,
render_traceback=render_traceback, render_traceback=render_traceback,
render_source_code_file=render_source_code_file, render_source_code_file=render_source_code_file,
pygment_css=HtmlFormatter().get_style_defs()) pygment_css=HtmlFormatter().get_style_defs())
......
...@@ -5,3 +5,4 @@ requests ...@@ -5,3 +5,4 @@ requests
rdflib rdflib
pygments pygments
anybadge anybadge
hg+https://forge.extranet.logilab.fr/open-source/heptalab
...@@ -85,5 +85,14 @@ ...@@ -85,5 +85,14 @@
{% endfor %} {% endfor %}
<hr>
<h2>Project with outdated dependencies (but deprecated warnings):</h2>
<ul>
{% for outdated_project, dependencies in outdated_projects %}
<li><a href="{{ outdated_project.web_url }}">{{ outdated_project.name }}</a>: {{ dependencies["cubicweb"] }} != {{ ".".join(map(str, cubicweb_latest_version)) }}</li>
{% endfor %}
</ul>
</body> </body>
</html> </html>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment