Skip to content

Commit cb5c4ab

Browse files
authored
Added module flagging from libraries.json (boostorg#1900) (boostorg#1926)
1 parent 6332174 commit cb5c4ab

File tree

13 files changed

+68
-19
lines changed

13 files changed

+68
-19
lines changed

core/githubhelper.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -623,6 +623,7 @@ def parse_libraries_json(self, libraries_json: dict) -> dict:
623623
"category": libraries_json.get("category", []),
624624
"maintainers": libraries_json.get("maintainers", []),
625625
"cxxstd": libraries_json.get("cxxstd"),
626+
"cpp20_module_support": libraries_json.get("modules", False),
626627
}
627628

628629
def parse_tag(self, tag_data: dict) -> dict:

core/tests/test_githubhelper.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ def test_parse_libraries_json():
149149
"category": ["Math"],
150150
"maintainers": [],
151151
"cxxstd": "14",
152+
"modules": True,
152153
}
153154

154155
parser = GithubDataParser()

docs/examples/libraries_multiple.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@
7171
"category": [
7272
"Function-objects"
7373
],
74-
"cxxstd": "03"
74+
"cxxstd": "03",
75+
"modules": true
7576
}
7677
]

libraries/admin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ def get_new_contributor_counts(self, pk):
348348
@admin.register(LibraryVersion)
349349
class LibraryVersionAdmin(admin.ModelAdmin):
350350
list_display = ["library", "version", "missing_docs", "documentation_url"]
351-
list_filter = ["library", "version", "missing_docs"]
351+
list_filter = ["library", "version", "missing_docs", "cpp20_module_support"]
352352
ordering = ["library__name", "-version__name"]
353353
search_fields = ["library__name", "version__name"]
354354
change_list_template = "admin/libraryversion_change_list.html"
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Generated by Django 4.2.24 on 2025-09-18 23:53
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
("libraries", "0032_merge_20250905_1825"),
10+
]
11+
12+
operations = [
13+
migrations.AddField(
14+
model_name="libraryversion",
15+
name="cpp20_module_support",
16+
field=models.BooleanField(default=False),
17+
),
18+
]

libraries/models.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,7 @@ class LibraryVersion(models.Model):
449449
deletions = models.IntegerField(default=0)
450450
files_changed = models.IntegerField(default=0)
451451
cpp_standard_minimum = models.CharField(max_length=50, blank=True, null=True)
452+
cpp20_module_support = models.BooleanField(default=False)
452453
dependencies = models.ManyToManyField(
453454
"libraries.Library",
454455
symmetrical=False,

libraries/tests/test_github.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ def test_get_library_list(library_updater):
7171
"category": ["Test"],
7272
"authors": ["John Doe"],
7373
"maintainers": ["Jane Doe"],
74+
"cpp20_module_support": False,
7475
}
7576
]
7677
result = library_updater.get_library_list(gitmodules=gitmodules)

templates/libraries/_library_categorized_list_item.html

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,21 @@
66
>{{ library_version.library.name }}</a>
77
</td>
88

9-
<td class="py-2 align-top w-12">
10-
<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"
9+
<td class="w-12 align-top pt-2.5 pr-2">
10+
<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"
1111
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 %}">
1212
<span class="text-white dark:text-gray-800 tracking-wide scale-x-75 origin-left w-6 text-nowrap whitespace-nowrap">C++</span>
1313
{% if library_version.cpp_standard_minimum and library_version.cpp_standard_minimum != 'None' %}{{ library_version.cpp_standard_minimum }}{% else %}03{% endif %}
1414
</span>
1515
</td>
16-
<td class="align-top">
16+
<td class="w-8 pt-2 px-2 text-center align-top">
17+
{% if library_version.cpp20_module_support %}
18+
<span
19+
class="text-sm font-bold text-gray-600"
20+
title="Supports usage via C++ 20 modules (import)"><i class="fa-solid fa-puzzle-piece"></i></span>
21+
{% endif %}
22+
</td>
23+
<td class="w-8 text-center align-top ">
1724
{% include "libraries/includes/_documentation_link_icon.html" %}
1825
</td>
1926
<td class="hidden md:block py-2 pl-3 align-top">{{ library_version.description|default:"No description provided for this version." }}</td>

templates/libraries/_library_grid_list_item.html

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,17 @@ <h3 class="pb-2 text-xl md:text-2xl capitalize border-b border-gray-700">
2121
<p class="mb-3 text-gray-700 dark:text-gray-300">{{ library_version.description|default:"No description provided for this version." }}</p>
2222
</div>
2323
<div class="text-sm flex py-3 bottom-3 absolute w-4/5 md:w-11/12">
24-
<div>
24+
<div class="flex">
2525
<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"
2626
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">
2727
<span class="text-white dark:text-gray-800 tracking-wide scale-x-75 origin-left w-6 text-nowrap whitespace-nowrap">C++</span>
2828
{% if library_version.cpp_standard_minimum and library_version.cpp_standard_minimum != 'None' %}{{ library_version.cpp_standard_minimum }}{% else %}03{% endif %}
2929
</span>
30+
{% if library_version.cpp20_module_support %}
31+
<span
32+
class="ml-3 mt-[1px] text-sm font-bold text-gray-600"
33+
title="Supports usage via C++ 20 modules (import)"><i class="fa-solid fa-puzzle-piece"></i></span>
34+
{% endif %}
3035
</div>
3136
{# <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>#}
3237
<div class="w-auto md:w-5/6 pl-2 text-right mr-2 font-bold capitalize text-sky-600 dark:text-sky-300">
Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,28 @@
11
<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"
22
onclick="window.location='{% url 'library-detail' library_slug=library_version.library.slug version_slug=version_str %}'">
3-
<td class="py-2 align-top md:w-1/5">
3+
<td class="align-top md:w-1/5 pt-3">
44
<a class="mr-1 pl-1 font-bold capitalize text-sky-600 dark:text-sky-300 hover:text-orange dark:hover:text-orange"
55
href="{% url 'library-detail' library_slug=library_version.library.slug version_slug=version_str %}">{{ library_version.library.name }}</a>
66
</td>
7-
8-
<td class="py-2 px-2 align-top w-12">
9-
<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"
7+
<td class="align-top w-12 pt-3 pr-2">
8+
<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"
109
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 %}">
1110
<span class="text-white dark:text-gray-800 tracking-wide scale-x-75 origin-left w-6 text-nowrap whitespace-nowrap">C++</span>
1211
{% if library_version.cpp_standard_minimum and library_version.cpp_standard_minimum != 'None' %}{{ library_version.cpp_standard_minimum }}{% else %}03{% endif %}
1312
</span>
1413
</td>
15-
<td class="align-top">
14+
<td class="w-8 text-center align-top pt-3">
15+
{% if library_version.cpp20_module_support %}
16+
<span
17+
class="align-top text-sm font-bold text-gray-600 m-auto"
18+
title="Supports usage via C++ 20 modules (import)"><i class="fa-solid fa-puzzle-piece"></i></span>
19+
{% endif %}
20+
</td>
21+
<td class="w-8 align-top">
1622
{% include "libraries/includes/_documentation_link_icon.html" %}
1723
</td>
18-
<td class="hidden md:block py-2 pl-3 align-top">{{ library_version.description|default:"No description provided for this version." }}</td>
24+
<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>
1925
</tr>
20-
<tr class="block md:hidden pl-1">
26+
<tr class="block md:hidden pl-1 align-top">
2127
<td>{{ library_version.description|default:"No description provided for this version." }}</td>
2228
</tr>

0 commit comments

Comments
 (0)