Skip to content

Commit

Permalink
Add recipe latest version to the table
Browse files Browse the repository at this point in the history
Signed-off-by: Martin Tzvetanov Grigorov <[email protected]>
  • Loading branch information
martin-g committed Nov 28, 2024
1 parent eda8dec commit f53a151
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
18 changes: 14 additions & 4 deletions source/_ext/bioconda_sphinx_ext.py
Original file line number Diff line number Diff line change
Expand Up @@ -402,12 +402,14 @@ def generate(self, docnames: Optional[List[str]] = None):
if docnames and docname not in docnames:
continue

description = recipes_details[name]
recipe_details = recipes_details.get(name, {})

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

collapse = True
Expand Down Expand Up @@ -574,6 +576,8 @@ def generate_readme(recipe_basedir, output_dir, folder, repodata, renderer):
logger.error("Unable to process %s: %s", meta_fname, e)
return []

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

# Format the README
packages = []
for package in sorted(list(set(recipe.package_names))):
Expand All @@ -592,6 +596,10 @@ def generate_readme(recipe_basedir, output_dir, folder, repodata, renderer):
build_number=sorted_versions[0][1],
)[0]
]

if recipe.name == package:
recipe_details['latest-version'] = sorted_versions[0][0]
# recipe_details['build_number'] = sorted_versions[0][1]
else:
depends = []

Expand All @@ -611,9 +619,11 @@ def generate_readme(recipe_basedir, output_dir, folder, repodata, renderer):
}

if recipe_extra is None:
recipes_details[recipe.name] = ''
recipe_details['additional-platforms'] = []
else:
recipes_details[recipe.name] = ', '.join(recipe_extra.get('additional-platforms', []))
recipe_details['additional-platforms'] = recipe_extra.get('additional-platforms', [])

recipes_details[recipe.name] = recipe_details

renderer.render_to_file(output_file, 'readme.rst_t', template_options)
return [output_file]
Expand Down
8 changes: 6 additions & 2 deletions source/templates/domainindex.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ <h1>{{ indextitle }}</h1>

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

Expand All @@ -80,7 +80,11 @@ <h1>{{ indextitle }}</h1>
data: dataset,
columns: [
{ title: "Name" },
{
{
title: "Latest version",
orderable: false
},
{
title: "Additional platforms",
orderable: false
},
Expand Down

0 comments on commit f53a151

Please sign in to comment.