Skip to content

Commit

Permalink
[MODEL] Adds support for Raspberry Pi 5+
Browse files Browse the repository at this point in the history
> see #156
  • Loading branch information
HorlogeSkynet committed Aug 14, 2024
1 parent 5114c7c commit 7471de1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ and this project (partially) adheres to [Semantic Versioning](https://semver.org

## [Unreleased]
### Added
- `Model` support for Raspberry Pi 5+
- AppArmor confinement profile (included in Debian and AUR packages)

## [v4.14.3.0] - 2024-04-06
Expand Down
5 changes: 5 additions & 0 deletions archey/entries/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,11 @@ def _fetch_raspberry_pi_revision() -> Optional[str]:
except OSError:
return None

# Honor 'Model' entry (if present), for Raspberry Pi 5+
model = re.search(r"(?<=Model\t: ).*", cpu_info)
if model is not None:
return model.group(0)

# If the output contains 'Hardware' and 'Revision'...
hardware = re.search(r"(?<=Hardware\t: ).*", cpu_info)
revision = re.search(r"(?<=Revision\t: ).*", cpu_info)
Expand Down
5 changes: 5 additions & 0 deletions archey/test/entries/test_archey_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,10 +217,15 @@ def test_fetch_raspberry_pi_revision(self):
"""Test `_fetch_raspberry_pi_revision` static method"""
with patch("archey.entries.model.open", mock_open()) as mock:
mock.return_value.read.side_effect = [
"Revision\t: REV\nSerial\t: SERIAL\nModel\t: HARDWARE Model MODEL Rev REVISION\n",
"Hardware\t: HARDWARE\nRevision\t: REVISION\n",
"processor : 0\ncpu family : X\n",
]

self.assertEqual(
Model._fetch_raspberry_pi_revision(), # pylint: disable=protected-access
"HARDWARE Model MODEL Rev REVISION",
)
self.assertEqual(
Model._fetch_raspberry_pi_revision(), # pylint: disable=protected-access
"Raspberry Pi HARDWARE (Rev. REVISION)",
Expand Down

0 comments on commit 7471de1

Please sign in to comment.