forked from Mirror/pmbootstrap
pmb.core.arch: Handle unsupported arches in from_machine_type() better (MR 2498)
Closes https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/issues/2501
This commit is contained in:
parent
8012b3cefe
commit
0752a202aa
2 changed files with 6 additions and 0 deletions
|
@ -61,6 +61,8 @@ class Arch(enum.Enum):
|
||||||
return Arch.armhf
|
return Arch.armhf
|
||||||
case "armv7l" | "armv8l":
|
case "armv7l" | "armv8l":
|
||||||
return Arch.armv7
|
return Arch.armv7
|
||||||
|
case _:
|
||||||
|
raise ValueError(f"Unsupported machine type '{machine_type}'")
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def native() -> "Arch":
|
def native() -> "Arch":
|
||||||
|
|
|
@ -77,3 +77,7 @@ def test_invalid_arches():
|
||||||
with pytest.raises(TypeError) as excinfo:
|
with pytest.raises(TypeError) as excinfo:
|
||||||
"bap" / Arch.aarch64
|
"bap" / Arch.aarch64
|
||||||
assert "unsupported operand type(s) for /: 'str' and 'Arch'" in str(excinfo.value)
|
assert "unsupported operand type(s) for /: 'str' and 'Arch'" in str(excinfo.value)
|
||||||
|
|
||||||
|
with pytest.raises(ValueError) as excinfo:
|
||||||
|
Arch.from_machine_type("invalid")
|
||||||
|
assert "Unsupported machine type 'invalid'" in str(excinfo.value)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue