From 909e652f0d5d915231fffa2f6a9b47a18a012cad Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 14 Sep 2024 15:23:06 +0200 Subject: [PATCH] os/debian --- rwx/os/__init__.py | 17 +++++++++++++++-- rwx/os/debian.py | 17 +++++++++++++++++ 2 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 rwx/os/debian.py diff --git a/rwx/os/__init__.py b/rwx/os/__init__.py index 70ca05c..3bd3c15 100644 --- a/rwx/os/__init__.py +++ b/rwx/os/__init__.py @@ -2,10 +2,23 @@ from pathlib import Path +from rwx.err import Error +from rwx.os.debian import Debian + class OS: """Operating System.""" - def __init__(self, path: str) -> None: + def __init__(self, path: Path) -> None: """Set root.""" - self.root = Path(path) + self.root = path + self.name = self.get_name() + + def get_name(self) -> str: + """Return mandatory name.""" + raise Error + + +def from_path(path: Path) -> OS: + """Initialize from an already existing path.""" + return Debian(path) diff --git a/rwx/os/debian.py b/rwx/os/debian.py new file mode 100644 index 0000000..f8b5fdd --- /dev/null +++ b/rwx/os/debian.py @@ -0,0 +1,17 @@ +"""Debian operating system.""" + +from pathlib import Path + +from . import OS + + +class Debian(OS): + """Debian operating system.""" + + def __init__(self, path: Path) -> None: + """Initialize.""" + super().__init__(path) + + def get_name(self) -> str: + """Return name.""" + return "Debian"