Added module flagging from libraries.json (#1900) (#1926)

This commit is contained in:
daveoconnor
2025-09-30 14:35:26 -07:00
committed by GitHub
parent 63321747ed
commit cb5c4ab492
13 changed files with 68 additions and 19 deletions

View File

@@ -623,6 +623,7 @@ class GithubDataParser:
"category": libraries_json.get("category", []),
"maintainers": libraries_json.get("maintainers", []),
"cxxstd": libraries_json.get("cxxstd"),
"cpp20_module_support": libraries_json.get("modules", False),
}
def parse_tag(self, tag_data: dict) -> dict:

View File

@@ -149,6 +149,7 @@ def test_parse_libraries_json():
"category": ["Math"],
"maintainers": [],
"cxxstd": "14",
"modules": True,
}
parser = GithubDataParser()

View File

@@ -71,6 +71,7 @@
"category": [
"Function-objects"
],
"cxxstd": "03"
"cxxstd": "03",
"modules": true
}
]

View File

@@ -348,7 +348,7 @@ class LibraryAdmin(admin.ModelAdmin):
@admin.register(LibraryVersion)
class LibraryVersionAdmin(admin.ModelAdmin):
list_display = ["library", "version", "missing_docs", "documentation_url"]
list_filter = ["library", "version", "missing_docs"]
list_filter = ["library", "version", "missing_docs", "cpp20_module_support"]
ordering = ["library__name", "-version__name"]
search_fields = ["library__name", "version__name"]
change_list_template = "admin/libraryversion_change_list.html"

View File

@@ -0,0 +1,18 @@
# Generated by Django 4.2.24 on 2025-09-18 23:53
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("libraries", "0032_merge_20250905_1825"),
]
operations = [
migrations.AddField(
model_name="libraryversion",
name="cpp20_module_support",
field=models.BooleanField(default=False),
),
]

View File

@@ -449,6 +449,7 @@ class LibraryVersion(models.Model):
deletions = models.IntegerField(default=0)
files_changed = models.IntegerField(default=0)
cpp_standard_minimum = models.CharField(max_length=50, blank=True, null=True)
cpp20_module_support = models.BooleanField(default=False)
dependencies = models.ManyToManyField(
"libraries.Library",
symmetrical=False,

View File

@@ -71,6 +71,7 @@ def test_get_library_list(library_updater):
"category": ["Test"],
"authors": ["John Doe"],
"maintainers": ["Jane Doe"],
"cpp20_module_support": False,
}
]
result = library_updater.get_library_list(gitmodules=gitmodules)

View File

@@ -6,14 +6,21 @@ onclick="window.location='{% url 'library-detail' library_slug=library_version.l
>{{ library_version.library.name }}</a>
</td>
<td class="py-2 align-top w-12">
<span class="flex justify-center py-0 px-2 text-sm font-bold text-gray-600 rounded-full border dark:text-gray-300 bg-green/40 border-green/60 dark:bg-green/40 tabular-nums"
<td class="w-12 align-top pt-2.5 pr-2">
<span class="flex justify-center px-2 text-sm font-bold text-gray-600 rounded-full border dark:text-gray-300 bg-green/40 border-green/60 dark:bg-green/40 tabular-nums"
title="{% if library_version.cpp_standard_minimum and library_version.cpp_standard_minimum != 'None' %}C++ Version {{ library_version.cpp_standard_minimum }} or Later{% else %}C++ Version 03 or Later{% endif %}">
<span class="text-white dark:text-gray-800 tracking-wide scale-x-75 origin-left w-6 text-nowrap whitespace-nowrap">C++</span>
{% if library_version.cpp_standard_minimum and library_version.cpp_standard_minimum != 'None' %}{{ library_version.cpp_standard_minimum }}{% else %}03{% endif %}
</span>
</td>
<td class="align-top">
<td class="w-8 pt-2 px-2 text-center align-top">
{% if library_version.cpp20_module_support %}
<span
class="text-sm font-bold text-gray-600"
title="Supports usage via C++ 20 modules (import)"><i class="fa-solid fa-puzzle-piece"></i></span>
{% endif %}
</td>
<td class="w-8 text-center align-top ">
{% include "libraries/includes/_documentation_link_icon.html" %}
</td>
<td class="hidden md:block py-2 pl-3 align-top">{{ library_version.description|default:"No description provided for this version." }}</td>

View File

@@ -21,12 +21,17 @@ onclick="window.location='{% url 'library-detail' library_slug=library_version.l
<p class="mb-3 text-gray-700 dark:text-gray-300">{{ library_version.description|default:"No description provided for this version." }}</p>
</div>
<div class="text-sm flex py-3 bottom-3 absolute w-4/5 md:w-11/12">
<div>
<div class="flex">
<span class="flex justify-center py-0 px-2 text-sm font-bold text-gray-600 rounded-full border dark:text-gray-300 bg-green/40 border-green/60 dark:bg-green/40 tabular-nums"
title="C++ Version {% if library_version.cpp_standard_minimum and library_version.cpp_standard_minimum != 'None' %}{{ library_version.cpp_standard_minimum }}{% else %}03{% endif %} or Later">
<span class="text-white dark:text-gray-800 tracking-wide scale-x-75 origin-left w-6 text-nowrap whitespace-nowrap">C++</span>
{% if library_version.cpp_standard_minimum and library_version.cpp_standard_minimum != 'None' %}{{ library_version.cpp_standard_minimum }}{% else %}03{% endif %}
</span>
{% if library_version.cpp20_module_support %}
<span
class="ml-3 mt-[1px] text-sm font-bold text-gray-600"
title="Supports usage via C++ 20 modules (import)"><i class="fa-solid fa-puzzle-piece"></i></span>
{% endif %}
</div>
{# <div class="w-1/6 tracking-wider text-charcoal dark:text-white/60">{% if library_version.library.first_boost_version %}{{ library_version.library.first_boost_version.release_date|years_since }} yrs{% endif %}</div>#}
<div class="w-auto md:w-5/6 pl-2 text-right mr-2 font-bold capitalize text-sky-600 dark:text-sky-300">

View File

@@ -1,22 +1,28 @@
<tr class="border-0 md:border border-gray-200/10 border-dotted md:border-t-0 md:border-r-0 md:border-l-0 md:border-b-1 hover:bg-gray-100 dark:hover:bg-gray-700 transition-all duration-300 ease-in-out cursor-pointer"
onclick="window.location='{% url 'library-detail' library_slug=library_version.library.slug version_slug=version_str %}'">
<td class="py-2 align-top md:w-1/5">
<td class="align-top md:w-1/5 pt-3">
<a class="mr-1 pl-1 font-bold capitalize text-sky-600 dark:text-sky-300 hover:text-orange dark:hover:text-orange"
href="{% url 'library-detail' library_slug=library_version.library.slug version_slug=version_str %}">{{ library_version.library.name }}</a>
</td>
<td class="py-2 px-2 align-top w-12">
<span class="flex justify-center py-0 px-2 text-sm font-bold text-gray-600 rounded-full border dark:text-gray-300 bg-green/40 border-green/60 dark:bg-green/40 tabular-nums"
<td class="align-top w-12 pt-3 pr-2">
<span class="flex justify-center px-2 text-sm font-bold text-gray-600 rounded-full border dark:text-gray-300 bg-green/40 border-green/60 dark:bg-green/40 tabular-nums"
title="{% if library_version.cpp_standard_minimum and library_version.cpp_standard_minimum != 'None' %}C++ Version {{ library_version.cpp_standard_minimum }} or Later{% else %}C++ Version 03 or Later{% endif %}">
<span class="text-white dark:text-gray-800 tracking-wide scale-x-75 origin-left w-6 text-nowrap whitespace-nowrap">C++</span>
{% if library_version.cpp_standard_minimum and library_version.cpp_standard_minimum != 'None' %}{{ library_version.cpp_standard_minimum }}{% else %}03{% endif %}
</span>
</td>
<td class="align-top">
<td class="w-8 text-center align-top pt-3">
{% if library_version.cpp20_module_support %}
<span
class="align-top text-sm font-bold text-gray-600 m-auto"
title="Supports usage via C++ 20 modules (import)"><i class="fa-solid fa-puzzle-piece"></i></span>
{% endif %}
</td>
<td class="w-8 align-top">
{% include "libraries/includes/_documentation_link_icon.html" %}
</td>
<td class="hidden md:block py-2 pl-3 align-top">{{ library_version.description|default:"No description provided for this version." }}</td>
<td class="align-top hidden md:block mt-2 pl-3 md:h-20 md:items-center h-full">{{ library_version.description|default:"No description provided for this version." }}</td>
</tr>
<tr class="block md:hidden pl-1">
<tr class="block md:hidden pl-1 align-top">
<td>{{ library_version.description|default:"No description provided for this version." }}</td>
</tr>

View File

@@ -37,10 +37,17 @@
<div class="pb-4 pt-1">
<span
class="py-0 px-2 text-sm font-bold text-gray-600 rounded-full border dark:text-gray-300 bg-green/40 border-green/60 dark:bg-green/40"
title="C++ Version {% if library_version.cpp_standard_minimum %}{{ library_version.cpp_standard_minimum }}{% else %}03{% endif %} or Later">
<span class="scale-x-75 text-white dark:text-gray-800 tracking-wide origin-left w-6 inline-block whitespace-nowrap">C++</span>
{% if library_version.cpp_standard_minimum %}{{ library_version.cpp_standard_minimum }}{% else %}03{% endif %}
</span>
title="C++ Version {% if library_version.cpp_standard_minimum %}{{ library_version.cpp_standard_minimum }}{% else %}03{% endif %} or Later"
><span
class="scale-x-75 text-white dark:text-gray-800 tracking-wide origin-left w-6 inline-block whitespace-nowrap"
>C++</span> {% if library_version.cpp_standard_minimum %}{{ library_version.cpp_standard_minimum }}{% else %}03{% endif %}</span>
{% if library_version.cpp20_module_support %}
<span
class="ml-2 text-sm font-bold text-gray-600 dark:text-gray-300"
title="Supports usage via C++ 20 modules (import)"><i class="fa-solid fa-puzzle-piece"></i></span>
{% endif %}
<span class="float-right">{% if object.first_boost_version %}Added in Boost
{{ object.first_boost_version.display_name }}{% endif %}</span>
</div>

View File

@@ -1,3 +1,3 @@
<a class="text-sky-600 dark:text-sky-300 hover:text-orange dark:hover:text-orange text-base block py-3 pr-2" href="{{ library_version.documentation_url }}" title="Documentation">
<i class="fa fa-book icon-link"></i>
<a class="text-sky-600 dark:text-sky-300 hover:text-orange dark:hover:text-orange text-base block py-3 text-center" href="{{ library_version.documentation_url }}" title="Documentation">
<i class="fa fa-book align-top"></i>
</a>

View File

@@ -375,6 +375,7 @@ def import_library_versions(version_name, token=None, version_type="tag"):
defaults={
"data": lib_data,
"cpp_standard_minimum": lib_data.get("cxxstd"),
"cpp20_module_support": lib_data.get("cpp20_module_support"),
"description": lib_data.get("description"),
},
)