|
1 | 1 | # frozen_string_literal: true |
2 | 2 |
|
| 3 | +require "set" |
| 4 | + |
3 | 5 | # Plugin that generates a Python repository index for GraalPy wheels at |
4 | 6 | # /python/wheels. The input is the graalpy_wheels.txt file next to this file. |
5 | 7 | # The wheels themselves are hosted in GDS. |
@@ -50,6 +52,38 @@ def generate(site) |
50 | 52 | package_page.content = render package_links |
51 | 53 | site.pages << package_page |
52 | 54 | end |
| 55 | + |
| 56 | + graalpy_versions = all_wheels.group_by do |wheel| |
| 57 | + wheel.filename =~ /graalpy(\d\d\d?)_/ |
| 58 | + $1 |
| 59 | + end |
| 60 | + graalpy_versions.each do |version, wheels| |
| 61 | + package_csv = Jekyll::PageWithoutAFile.new(site, "", "/wheels/", "v#{version}.csv") |
| 62 | + package_csv.content = wheels.group_by(&:name).map do |name, wheels| |
| 63 | + wheels.group_by { |w| w.filename.split("-")[1] }.map do |version, wheels| |
| 64 | + comment = "The GraalPy team provides binary wheels of this package for " |
| 65 | + platforms = wheels.map do |wheel| |
| 66 | + parts = wheel.filename.split("-") |
| 67 | + if parts.any? { |p| p.include? "linux" } |
| 68 | + "Linux" |
| 69 | + elsif parts.any? { |p| p.include? "win" } |
| 70 | + "Windows" |
| 71 | + elsif parts.any? { |p| p.include? "macos" } |
| 72 | + "macOS" |
| 73 | + end |
| 74 | + end.sort.compact |
| 75 | + if platforms.length == 1 |
| 76 | + comment += "#{platforms.first}." |
| 77 | + elsif platforms.length == 2 |
| 78 | + comment += "#{platforms.first} and #{platforms.last}." |
| 79 | + else |
| 80 | + comment += "#{platforms[0]}, #{platforms[1]}, and #{platforms[2]}." |
| 81 | + end |
| 82 | + "#{name},#{version},0,#{comment}" |
| 83 | + end |
| 84 | + end.flatten.join("\n") |
| 85 | + site.pages << package_csv |
| 86 | + end |
53 | 87 | end |
54 | 88 |
|
55 | 89 | def render(links) |
|
0 commit comments