-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
device-connectors: muxpi: refactor image detection logic to add more …
…modularity
- Loading branch information
1 parent
a77c0ee
commit 52f650f
Showing
2 changed files
with
140 additions
and
75 deletions.
There are no files selected for viewing
47 changes: 47 additions & 0 deletions
47
device-connectors/src/testflinger_device_connectors/devices/muxpi/image.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
from enum import Enum | ||
|
||
|
||
class ImageType(Enum): | ||
PE = 0 | ||
CE = 1 | ||
PI_DESKTOP = "pi-desktop" | ||
UBUNTU = "ubuntu" | ||
CORE = "core" | ||
CORE20 = "core20" | ||
UBUNTU_CPC = "ubuntu-cpc" | ||
|
||
|
||
class PEImageVariant(Enum): | ||
TEGRA = 0 | ||
KRIA = 1 | ||
|
||
|
||
class Image: | ||
def __init__(self, image_type: ImageType): | ||
self.image_type = image_type | ||
|
||
|
||
class PEImage(Image): | ||
def __init__(self, variant: PEImageVariant, **kwargs): | ||
super().__init__(image_type=ImageType.PE, **kwargs) | ||
self.variant = variant | ||
|
||
def __str__(self): | ||
return f"PEImage(image_type={self.image_type.name}, " | ||
"variant={self.variant.name})" | ||
|
||
def __repr__(self): | ||
return self.__str__() | ||
|
||
|
||
class CEImage(Image): | ||
def __init__(self, release: str, **kwargs): | ||
super().__init__(image_type=ImageType.CE, **kwargs) | ||
self.release = release | ||
|
||
def __str__(self): | ||
return f"CEImage(image_type={self.image_type.name}, " | ||
"release={self.release})" | ||
|
||
def __repr__(self): | ||
return self.__str__() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters