Skip to content

Commit

Permalink
Merge pull request #83 from hugovk/rename-headers
Browse files Browse the repository at this point in the history
  • Loading branch information
hugovk committed Jun 8, 2022
2 parents c0f4587 + 495b4e5 commit f7d5ba3
Show file tree
Hide file tree
Showing 7 changed files with 356 additions and 177 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
tox -e py
- name: Tox tests (pins)
if: matrix.python-version == '3.9' && matrix.os == 'ubuntu-latest'
if: matrix.python-version == '3.10' && matrix.os == 'ubuntu-latest'
shell: bash
run: |
tox -e pins
Expand Down
78 changes: 45 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ options:
-c {yes,no,auto}, --color {yes,no,auto}
color terminal output (default: auto)
--clear-cache Clear cache before running (default: False)
-v, --verbose Print debug messages to stderr (default: False)
-v, --verbose Print extra messages to stderr (default: 30)
-V, --version show program's version number and exit
```

Expand Down Expand Up @@ -105,17 +105,17 @@ run("norwegianblue python")

```console
$ norwegianblue python
| cycle | latest | release | eol |
|:------|:-------|:----------:|:----------:|
| 3.10 | 3.10.4 | 2021-10-04 | 2026-10-04 |
| 3.9 | 3.9.12 | 2020-10-05 | 2025-10-05 |
| 3.8 | 3.8.13 | 2019-10-14 | 2024-10-14 |
| 3.7 | 3.7.13 | 2018-06-27 | 2023-06-27 |
| 3.6 | 3.6.15 | 2016-12-23 | 2021-12-23 |
| 3.5 | 3.5.10 | 2015-09-13 | 2020-09-13 |
| 3.4 | 3.4.10 | 2014-03-16 | 2019-03-18 |
| 3.3 | 3.3.7 | 2012-09-29 | 2017-09-29 |
| 2.7 | 2.7.18 | 2010-07-03 | 2020-01-01 |
| cycle | release | latest | latest release | eol |
|:------|:----------:|:-------|:--------------:|:----------:|
| 3.10 | 2021-10-04 | 3.10.5 | 2022-06-06 | 2026-10-04 |
| 3.9 | 2020-10-05 | 3.9.13 | 2022-05-17 | 2025-10-05 |
| 3.8 | 2019-10-14 | 3.8.13 | 2022-03-16 | 2024-10-14 |
| 3.7 | 2018-06-26 | 3.7.13 | 2022-03-16 | 2023-06-27 |
| 3.6 | 2016-12-22 | 3.6.15 | 2021-09-03 | 2021-12-23 |
| 3.5 | 2015-09-12 | 3.5.10 | 2020-09-05 | 2020-09-13 |
| 3.4 | 2014-03-15 | 3.4.10 | 2019-03-18 | 2019-03-18 |
| 3.3 | 2012-09-29 | 3.3.7 | 2017-09-19 | 2017-09-29 |
| 2.7 | 2010-07-03 | 2.7.18 | 2020-04-19 | 2020-01-01 |
```

<!-- [[[end]]] -->
Expand All @@ -126,17 +126,17 @@ The table is Markdown, ready for pasting in GitHub issues and PRs:
run("norwegianblue python", with_console=False)
]]] -->

| cycle | latest | release | eol |
| :---- | :----- | :--------: | :--------: |
| 3.10 | 3.10.4 | 2021-10-04 | 2026-10-04 |
| 3.9 | 3.9.12 | 2020-10-05 | 2025-10-05 |
| 3.8 | 3.8.13 | 2019-10-14 | 2024-10-14 |
| 3.7 | 3.7.13 | 2018-06-27 | 2023-06-27 |
| 3.6 | 3.6.15 | 2016-12-23 | 2021-12-23 |
| 3.5 | 3.5.10 | 2015-09-13 | 2020-09-13 |
| 3.4 | 3.4.10 | 2014-03-16 | 2019-03-18 |
| 3.3 | 3.3.7 | 2012-09-29 | 2017-09-29 |
| 2.7 | 2.7.18 | 2010-07-03 | 2020-01-01 |
| cycle | release | latest | latest release | eol |
| :---- | :--------: | :----- | :------------: | :--------: |
| 3.10 | 2021-10-04 | 3.10.5 | 2022-06-06 | 2026-10-04 |
| 3.9 | 2020-10-05 | 3.9.13 | 2022-05-17 | 2025-10-05 |
| 3.8 | 2019-10-14 | 3.8.13 | 2022-03-16 | 2024-10-14 |
| 3.7 | 2018-06-26 | 3.7.13 | 2022-03-16 | 2023-06-27 |
| 3.6 | 2016-12-22 | 3.6.15 | 2021-09-03 | 2021-12-23 |
| 3.5 | 2015-09-12 | 3.5.10 | 2020-09-05 | 2020-09-13 |
| 3.4 | 2014-03-15 | 3.4.10 | 2019-03-18 | 2019-03-18 |
| 3.3 | 2012-09-29 | 3.3.7 | 2017-09-19 | 2017-09-29 |
| 2.7 | 2010-07-03 | 2.7.18 | 2020-04-19 | 2020-01-01 |

<!-- [[[end]]] -->

Expand All @@ -150,16 +150,28 @@ run("eol nodejs --format rst")
$ eol nodejs --format rst
.. table::

======== ========== ============ ============ ============
cycle latest release support eol
======== ========== ============ ============ ============
17 17.8.0 2021-10-19 2022-04-01 2022-06-01
16 LTS 16.14.2 2021-04-20 2022-10-18 2024-04-30
15 15.14.0 2020-10-20 2021-04-01 2021-06-01
14 LTS 14.19.1 2020-04-21 2021-10-19 2023-04-30
12 LTS 12.22.11 2019-04-23 2020-10-20 2022-04-30
10 LTS 10.24.1 2018-04-24 2020-05-19 2021-04-30
======== ========== ============ ============ ============
======== ============ ========== ================ ============ ============
cycle release latest latest release support eol
======== ============ ========== ================ ============ ============
18 LTS 2022-04-19 18.3.0 2022-06-01 2023-10-18 2025-04-30
17 2021-10-19 17.9.1 2022-06-01 2022-04-01 2022-06-01
16 LTS 2021-04-20 16.15.1 2022-06-01 2022-10-18 2024-04-30
15 2020-10-20 15.14.0 2021-04-06 2021-04-01 2021-06-01
14 LTS 2020-04-21 14.19.3 2022-05-17 2021-10-19 2023-04-30
13 2019-10-22 13.14.0 2020-04-29 2020-04-01 2020-06-01
12 LTS 2019-04-23 12.22.12 2022-04-05 2020-10-20 2022-04-30
11 2018-10-23 11.15.0 2019-04-30 2019-04-01 2019-06-30
10 LTS 2018-04-24 10.24.1 2021-04-06 2020-05-19 2021-04-30
9 2017-10-31 9.11.2 2018-06-12 2018-06-30 2018-06-30
8 LTS 2017-05-30 8.17.0 2019-12-17 2019-01-01 2019-12-31
7 2016-10-25 7.10.1 2017-07-11 2017-06-30 2017-06-30
6 LTS 2016-04-26 6.17.1 2019-04-03 2018-04-30 2019-04-30
5 2015-10-30 5.12.0 2016-06-23 2016-06-30 2016-06-30
4 LTS 2015-09-09 4.9.1 2018-03-29 2017-04-01 2018-04-30
3 2015-08-04 3.3.1 2015-09-15 False True
2 2015-05-04 2.5.0 2015-07-28 False True
1 2015-01-20 1.8.4 2015-07-09 False True
======== ============ ========== ================ ============ ============
```

<!-- [[[end]]] -->
Expand Down
11 changes: 9 additions & 2 deletions src/norwegianblue/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,13 @@ def _colourify(data: list[dict]) -> list[dict]:
def _tabulate(data: list[dict], format: str = "markdown") -> str:
"""Return data in specified format"""

# Rename some headers
for row in data:
if "releaseDate" in row:
row["release"] = row.pop("releaseDate")
if "latestReleaseDate" in row:
row["latest release"] = row.pop("latestReleaseDate")

headers = sorted(set().union(*(d.keys() for d in data)))

# Skip some headers, only used internally at https://endoflife.date
Expand All @@ -158,9 +165,9 @@ def _tabulate(data: list[dict], format: str = "markdown") -> str:
new_headers = []
for preferred in (
"cycle",
"releaseDate",
"release",
"latest",
"latestReleaseDate",
"latest release",
"support",
"discontinued",
"eol",
Expand Down
98 changes: 60 additions & 38 deletions tests/data/expected_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<thead>
<tr>
<th>cycle</th>
<th>releaseDate</th>
<th>release</th>
<th>latest</th>
<th>support</th>
<th>eol</th>
Expand Down Expand Up @@ -98,56 +98,55 @@
"""

EXPECTED_MD = """
| cycle | releaseDate | latest | support | eol | codename | link |
|:----------|:-----------:|:--------|:----------:|:----------:|:---------------:|:-----------------------------------------------------|
| 22.04 LTS | 2022-04-21 | 22.04 | 2027-04-02 | 2032-04-01 | Jammy Jellyfish | https://wiki.ubuntu.com/JammyJellyfish/ReleaseNotes/ |
| 21.10 | 2021-10-14 | 21.10 | 2022-07-31 | 2022-07-31 | Impish Indri | https://wiki.ubuntu.com/ImpishIndri/ReleaseNotes/ |
| 21.04 | 2021-04-22 | 21.04 | 2022-01-20 | 2022-01-20 | Hirsute Hippo | https://wiki.ubuntu.com/HirsuteHippo/ReleaseNotes/ |
| 20.10 | 2020-10-22 | 20.10 | 2021-07-22 | 2021-07-22 | Groovy Gorilla | |
| 20.04 LTS | 2020-04-23 | 20.04.4 | 2025-04-02 | 2030-04-01 | Focal Fossa | |
| 19.10 | 2019-10-17 | 19.10 | 2020-07-06 | 2020-07-06 | Karmic Koala | |
| 18.04 LTS | 2018-04-26 | 18.04.6 | 2023-04-02 | 2028-04-01 | Bionic Beaver | https://wiki.ubuntu.com/BionicBeaver/ReleaseNotes |
| 16.04 LTS | 2016-04-21 | 16.04.7 | 2021-04-02 | 2026-04-01 | Xenial Xerus | |
| 14.04 LTS | 2014-04-17 | 14.04.6 | 2019-04-02 | 2024-04-01 | Trusty Tahr | |
| cycle | release | latest | support | eol | codename | link |
|:----------|:----------:|:--------|:----------:|:----------:|:---------------:|:-----------------------------------------------------|
| 22.04 LTS | 2022-04-21 | 22.04 | 2027-04-02 | 2032-04-01 | Jammy Jellyfish | https://wiki.ubuntu.com/JammyJellyfish/ReleaseNotes/ |
| 21.10 | 2021-10-14 | 21.10 | 2022-07-31 | 2022-07-31 | Impish Indri | https://wiki.ubuntu.com/ImpishIndri/ReleaseNotes/ |
| 21.04 | 2021-04-22 | 21.04 | 2022-01-20 | 2022-01-20 | Hirsute Hippo | https://wiki.ubuntu.com/HirsuteHippo/ReleaseNotes/ |
| 20.10 | 2020-10-22 | 20.10 | 2021-07-22 | 2021-07-22 | Groovy Gorilla | |
| 20.04 LTS | 2020-04-23 | 20.04.4 | 2025-04-02 | 2030-04-01 | Focal Fossa | |
| 19.10 | 2019-10-17 | 19.10 | 2020-07-06 | 2020-07-06 | Karmic Koala | |
| 18.04 LTS | 2018-04-26 | 18.04.6 | 2023-04-02 | 2028-04-01 | Bionic Beaver | https://wiki.ubuntu.com/BionicBeaver/ReleaseNotes |
| 16.04 LTS | 2016-04-21 | 16.04.7 | 2021-04-02 | 2026-04-01 | Xenial Xerus | |
| 14.04 LTS | 2014-04-17 | 14.04.6 | 2019-04-02 | 2024-04-01 | Trusty Tahr | |
""" # noqa: E501


EXPECTED_MD_COLOUR = """
| cycle | releaseDate | latest | support | eol | codename | link |
|:----------|:-----------:|:--------|:----------:|:----------:|:---------------:|:-----------------------------------------------------|
| 22.04 LTS | 2022-04-21 | 22.04 | 2027-04-02 | 2032-04-01 | Jammy Jellyfish | https://wiki.ubuntu.com/JammyJellyfish/ReleaseNotes/ |
| 21.10 | 2021-10-14 | 21.10 | 2022-07-31 | 2022-07-31 | Impish Indri | https://wiki.ubuntu.com/ImpishIndri/ReleaseNotes/ |
| 21.04 | 2021-04-22 | 21.04 | 2022-01-20 | 2022-01-20 | Hirsute Hippo | https://wiki.ubuntu.com/HirsuteHippo/ReleaseNotes/ |
| 20.10 | 2020-10-22 | 20.10 | 2021-07-22 | 2021-07-22 | Groovy Gorilla | |
| 20.04 LTS | 2020-04-23 | 20.04.4 | 2025-04-02 | 2030-04-01 | Focal Fossa | |
| 19.10 | 2019-10-17 | 19.10 | 2020-07-06 | 2020-07-06 | Karmic Koala | |
| 18.04 LTS | 2018-04-26 | 18.04.6 | 2023-04-02 | 2028-04-01 | Bionic Beaver | https://wiki.ubuntu.com/BionicBeaver/ReleaseNotes |
| 16.04 LTS | 2016-04-21 | 16.04.7 | 2021-04-02 | 2026-04-01 | Xenial Xerus | |
| 14.04 LTS | 2014-04-17 | 14.04.6 | 2019-04-02 | 2024-04-01 | Trusty Tahr | |
| cycle | release | latest | support | eol | codename | link |
|:----------|:----------:|:--------|:----------:|:----------:|:---------------:|:-----------------------------------------------------|
| 22.04 LTS | 2022-04-21 | 22.04 | 2027-04-02 | 2032-04-01 | Jammy Jellyfish | https://wiki.ubuntu.com/JammyJellyfish/ReleaseNotes/ |
| 21.10 | 2021-10-14 | 21.10 | 2022-07-31 | 2022-07-31 | Impish Indri | https://wiki.ubuntu.com/ImpishIndri/ReleaseNotes/ |
| 21.04 | 2021-04-22 | 21.04 | 2022-01-20 | 2022-01-20 | Hirsute Hippo | https://wiki.ubuntu.com/HirsuteHippo/ReleaseNotes/ |
| 20.10 | 2020-10-22 | 20.10 | 2021-07-22 | 2021-07-22 | Groovy Gorilla | |
| 20.04 LTS | 2020-04-23 | 20.04.4 | 2025-04-02 | 2030-04-01 | Focal Fossa | |
| 19.10 | 2019-10-17 | 19.10 | 2020-07-06 | 2020-07-06 | Karmic Koala | |
| 18.04 LTS | 2018-04-26 | 18.04.6 | 2023-04-02 | 2028-04-01 | Bionic Beaver | https://wiki.ubuntu.com/BionicBeaver/ReleaseNotes |
| 16.04 LTS | 2016-04-21 | 16.04.7 | 2021-04-02 | 2026-04-01 | Xenial Xerus | |
| 14.04 LTS | 2014-04-17 | 14.04.6 | 2019-04-02 | 2024-04-01 | Trusty Tahr | |
""" # noqa: E501


EXPECTED_RST = """
.. table::
=========== ============= ========= ============ ============ ================= ======================================================
cycle releaseDate latest support eol codename link
=========== ============= ========= ============ ============ ================= ======================================================
22.04 LTS 2022-04-21 22.04 2027-04-02 2032-04-01 Jammy Jellyfish https://wiki.ubuntu.com/JammyJellyfish/ReleaseNotes/
21.10 2021-10-14 21.10 2022-07-31 2022-07-31 Impish Indri https://wiki.ubuntu.com/ImpishIndri/ReleaseNotes/
21.04 2021-04-22 21.04 2022-01-20 2022-01-20 Hirsute Hippo https://wiki.ubuntu.com/HirsuteHippo/ReleaseNotes/
20.10 2020-10-22 20.10 2021-07-22 2021-07-22 Groovy Gorilla
20.04 LTS 2020-04-23 20.04.4 2025-04-02 2030-04-01 Focal Fossa
19.10 2019-10-17 19.10 2020-07-06 2020-07-06 Karmic Koala
18.04 LTS 2018-04-26 18.04.6 2023-04-02 2028-04-01 Bionic Beaver https://wiki.ubuntu.com/BionicBeaver/ReleaseNotes
16.04 LTS 2016-04-21 16.04.7 2021-04-02 2026-04-01 Xenial Xerus
14.04 LTS 2014-04-17 14.04.6 2019-04-02 2024-04-01 Trusty Tahr
=========== ============= ========= ============ ============ ================= ======================================================
=========== ============ ========= ============ ============ ================= ======================================================
cycle release latest support eol codename link
=========== ============ ========= ============ ============ ================= ======================================================
22.04 LTS 2022-04-21 22.04 2027-04-02 2032-04-01 Jammy Jellyfish https://wiki.ubuntu.com/JammyJellyfish/ReleaseNotes/
21.10 2021-10-14 21.10 2022-07-31 2022-07-31 Impish Indri https://wiki.ubuntu.com/ImpishIndri/ReleaseNotes/
21.04 2021-04-22 21.04 2022-01-20 2022-01-20 Hirsute Hippo https://wiki.ubuntu.com/HirsuteHippo/ReleaseNotes/
20.10 2020-10-22 20.10 2021-07-22 2021-07-22 Groovy Gorilla
20.04 LTS 2020-04-23 20.04.4 2025-04-02 2030-04-01 Focal Fossa
19.10 2019-10-17 19.10 2020-07-06 2020-07-06 Karmic Koala
18.04 LTS 2018-04-26 18.04.6 2023-04-02 2028-04-01 Bionic Beaver https://wiki.ubuntu.com/BionicBeaver/ReleaseNotes
16.04 LTS 2016-04-21 16.04.7 2021-04-02 2026-04-01 Xenial Xerus
14.04 LTS 2014-04-17 14.04.6 2019-04-02 2024-04-01 Trusty Tahr
=========== ============ ========= ============ ============ ================= ======================================================
""" # noqa: E501 W291

EXPECTED_TSV = """
"cycle" "releaseDate" "latest" "support" "eol" "codename" "link"
"cycle" "release" "latest" "support" "eol" "codename" "link"
"22.04 LTS" "2022-04-21" "22.04" "2027-04-02" "2032-04-01" "Jammy Jellyfish" "https://wiki.ubuntu.com/JammyJellyfish/ReleaseNotes/"
"21.10" "2021-10-14" "21.10" "2022-07-31" "2022-07-31" "Impish Indri" "https://wiki.ubuntu.com/ImpishIndri/ReleaseNotes/"
"21.04" "2021-04-22" "21.04" "2022-01-20" "2022-01-20" "Hirsute Hippo" "https://wiki.ubuntu.com/HirsuteHippo/ReleaseNotes/"
Expand All @@ -158,3 +157,26 @@
"16.04 LTS" "2016-04-21" "16.04.7" "2021-04-02" "2026-04-01" "Xenial Xerus"
"14.04 LTS" "2014-04-17" "14.04.6" "2019-04-02" "2024-04-01" "Trusty Tahr"
""" # noqa: E501 W291

EXPECTED_MD_LOG4J = """
| cycle | release | latest | eol |
|:------|:----------:|:-------|:----------:|
| 2 | 2014-07-12 | 2.17.2 | False |
| 2.12 | 2019-06-23 | 2.12.4 | 2021-12-14 |
| 2.3 | 2015-05-09 | 2.3.2 | 2015-09-20 |
| 1 | 2001-01-08 | 1.2.17 | 2015-10-15 |
"""

EXPECTED_MD_PYTHON = """
| cycle | release | latest | latest release | eol |
|:------|:----------:|:-------|:--------------:|:----------:|
| 3.10 | 2021-10-04 | 3.10.5 | 2022-06-06 | 2026-10-04 |
| 3.9 | 2020-10-05 | 3.9.13 | 2022-05-17 | 2025-10-05 |
| 3.8 | 2019-10-14 | 3.8.13 | 2022-03-16 | 2024-10-14 |
| 3.7 | 2018-06-26 | 3.7.13 | 2022-03-16 | 2023-06-27 |
| 3.6 | 2016-12-22 | 3.6.15 | 2021-09-03 | 2021-12-23 |
| 3.5 | 2015-09-12 | 3.5.10 | 2020-09-05 | 2020-09-13 |
| 3.4 | 2014-03-15 | 3.4.10 | 2019-03-18 | 2019-03-18 |
| 3.3 | 2012-09-29 | 3.3.7 | 2017-09-19 | 2017-09-29 |
| 2.7 | 2010-07-03 | 2.7.18 | 2020-04-19 | 2020-01-01 |
"""

0 comments on commit f7d5ba3

Please sign in to comment.