Skip to content

Commit

Permalink
add links to patches
Browse files Browse the repository at this point in the history
Signed-off-by: vsoch <vsoch@users.noreply.github.com>
  • Loading branch information
vsoch committed Jun 27, 2021
1 parent 753e479 commit ca2520c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
6 changes: 4 additions & 2 deletions generate_packages.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@ def main():
for name, variant in pkg.variants.items():
if name not in package_variants:
package_variants[name] = []
package_variants[name].append({"package": pkg.name, "default": variant.default})
package_variants[name].append(
{"package": pkg.name, "default": variant.default}
)
variants.append(
{
"name": name,
Expand Down Expand Up @@ -143,7 +145,7 @@ def main():
# Save package variants
outfile = os.path.join(here, "data", "variants.json")
write_json(package_variants, outfile)

# We need one file with all names available
names = list(metas.keys())
names.sort()
Expand Down
11 changes: 9 additions & 2 deletions package.html
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,8 @@ <h2 style="margin-left:25px" id="package-name"></h2>
var build_system = data['build_system'].toLowerCase() + ".html";
url = "https://spack.readthedocs.io/en/latest/build_systems/" + build_system
}
package_py = "https://github.com/spack/spack/tree/develop/var/spack/repos/builtin/packages/" + data['name'] + "/package.py"
package_dir = "https://github.com/spack/spack/tree/develop/var/spack/repos/builtin/packages/" + data['name']
package_py = package_dir + "/package.py"
$("#build_system").html("<a target='_blank' href='" + url + "'>" + data['build_system'] + "</a> (view <a target='_blank' href='"+ package_py +"'>package.py</a>)");

var versions = ""
Expand Down Expand Up @@ -227,7 +228,13 @@ <h2 style="margin-left:25px" id="package-name"></h2>
if (data['patches'].length != 0) {
var patches = ""
$.each(data['patches'], function(i, item) {
patches += "<span style='font-weight:600'>" + item['relative_path'] + " </span>when " + item['version'] + "<br>";
var link = ""
if ('relative_path' in item){
link = "<a target='_blank' href='" + package_dir + "/" + item['relative_path'] + "'>" + item['relative_path'] + "</a>"
} else {
link = "<a target='_blank' href='" + item['url'] + "'>link</a>"
}
patches += "<span style='font-weight:600'>" + link + " </span>when " + item['version'] + "<br>";
});
$("#patches").html(patches);
$("#patches-row").show();
Expand Down

0 comments on commit ca2520c

Please sign in to comment.