Skip to content

Commit

Permalink
Add info about noarch recipes to the package index page
Browse files Browse the repository at this point in the history
Signed-off-by: Martin Tzvetanov Grigorov <mgrigorov@apache.org>
  • Loading branch information
martin-g committed Nov 29, 2024
1 parent 15ece24 commit f854a6f
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 4 deletions.
17 changes: 14 additions & 3 deletions source/_ext/bioconda_sphinx_ext.py
Original file line number Diff line number Diff line change
Expand Up @@ -404,12 +404,21 @@ def generate(self, docnames: Optional[List[str]] = None):

recipe_details = recipes_details.get(name, {})

platforms = []
noarch = recipe_details.get('noarch')
if noarch:
platforms.append("noarch (%s)" % noarch)

additional_platforms = recipe_details.get('additional-platforms', [])
if len(additional_platforms) > 0:
platforms.extend(additional_platforms)

# TODO: Add meaningful info for extra/qualifier/description
# fields, e.g., latest package version.
content.append({
"name": name,
"additional-platforms": ', '.join(recipe_details.get('additional-platforms', [])),
"latest-version": recipe_details.get('latest-version')
"additional_platforms": ', '.join(platforms),
"latest_version": recipe_details.get('latest_version')
})

collapse = True
Expand Down Expand Up @@ -577,6 +586,8 @@ def generate_readme(recipe_basedir, output_dir, folder, repodata, renderer):
return []

recipe_details = recipes_details.get(recipe.name, {})

recipe_details['noarch'] = recipe.meta["build"].get("noarch", '')

# Format the README
packages = []
Expand All @@ -598,7 +609,7 @@ def generate_readme(recipe_basedir, output_dir, folder, repodata, renderer):
]

if recipe.name == package:
recipe_details['latest-version'] = sorted_versions[0][0]
recipe_details['latest_version'] = sorted_versions[0][0]
# recipe_details['build_number'] = sorted_versions[0][1]
else:
depends = []
Expand Down
13 changes: 12 additions & 1 deletion source/templates/domainindex.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ <h1>{{ indextitle }}</h1>
<td id="total-count" style="text-align: center;"></td>
<td></td>
</tr>
<tr>
<td>noarch</td>
<td id="noarch-count" style="text-align: center;"></td>
<td><span id="noarch-ratio"></span>%</td>
</tr>
<tr>
<td>linux-aarch64</td>
<td id="linux-aarch64-count" style="text-align: center;"></td>
Expand All @@ -54,12 +59,13 @@ <h1>{{ indextitle }}</h1>

let dataset = [
{%- for (entry) in content %}
["{{ entry.name }}", "{{ entry['latest-version'] }}", "{{ entry['additional-platforms'] }}"]{%- if not loop.last -%}{{ "," }}{%- endif -%}
["{{ entry.name }}", "{{ entry.latest_version }}", "{{ entry.additional_platforms }}"]{%- if not loop.last -%}{{ "," }}{%- endif -%}
{%- endfor %}
];

let aarch64Count = 0;
let arm64Count = 0;
let noarchCount = 0;
for (let i=0; i<dataset.length; i++) {
let entry = dataset[i];
if (entry[2].includes("linux-aarch64")) {
Expand All @@ -68,8 +74,13 @@ <h1>{{ indextitle }}</h1>
if (entry[2].includes("osx-arm64")) {
arm64Count += 1;
}
if (entry[2].includes("noarch")) {
noarchCount += 1;
}
}
let totalCount = dataset.length;
document.getElementById("noarch-count").textContent = noarchCount;
document.getElementById("noarch-ratio").textContent = (noarchCount / totalCount * 100).toFixed(2);
document.getElementById("linux-aarch64-count").textContent = aarch64Count;
document.getElementById("linux-aarch64-ratio").textContent = (aarch64Count / totalCount * 100).toFixed(2);
document.getElementById("osx-arm64-count").textContent = arm64Count;
Expand Down

0 comments on commit f854a6f

Please sign in to comment.