refactor(history): commit development branch
All checks were successful
/ job (push) Successful in 1m12s
All checks were successful
/ job (push) Successful in 1m12s
new development branch from root commit
This commit is contained in:
parent
3e562930f6
commit
020aaa0b9a
94 changed files with 4804 additions and 0 deletions
20
rwx/os/__init__.py
Normal file
20
rwx/os/__init__.py
Normal file
|
@ -0,0 +1,20 @@
|
|||
"""Control Operating Systems."""
|
||||
|
||||
from os import sep
|
||||
from pathlib import Path
|
||||
|
||||
from .abstract import OS
|
||||
from .debian import Debian
|
||||
|
||||
|
||||
def from_path(path: Path) -> OS:
|
||||
"""Initialize from an already existing path.
|
||||
|
||||
:param path: source root directory
|
||||
:type path: Path
|
||||
:rtype: OS
|
||||
"""
|
||||
return Debian(path)
|
||||
|
||||
|
||||
up = from_path(Path(sep))
|
26
rwx/os/abstract.py
Normal file
26
rwx/os/abstract.py
Normal file
|
@ -0,0 +1,26 @@
|
|||
"""Abstract Operating System."""
|
||||
|
||||
from abc import ABC, abstractmethod
|
||||
from pathlib import Path
|
||||
|
||||
from rwx import Object
|
||||
|
||||
|
||||
class OS(Object, ABC):
|
||||
"""Operating System."""
|
||||
|
||||
def __init__(self, path: Path) -> None:
|
||||
"""Set root.
|
||||
|
||||
:param path: root directory
|
||||
:type path: Path
|
||||
"""
|
||||
self.root = path
|
||||
self.name = self.get_name()
|
||||
|
||||
@abstractmethod
|
||||
def get_name(self) -> str:
|
||||
"""Return mandatory name.
|
||||
|
||||
:rtype: str
|
||||
"""
|
14
rwx/os/debian.py
Normal file
14
rwx/os/debian.py
Normal file
|
@ -0,0 +1,14 @@
|
|||
"""Debian operating system."""
|
||||
|
||||
from .abstract import OS
|
||||
|
||||
|
||||
class Debian(OS):
|
||||
"""Debian operating system."""
|
||||
|
||||
def get_name(self) -> str:
|
||||
"""Return name.
|
||||
|
||||
:rtype: str
|
||||
"""
|
||||
return "Debian"
|
29
rwx/os/pm/__init__.py
Normal file
29
rwx/os/pm/__init__.py
Normal file
|
@ -0,0 +1,29 @@
|
|||
"""Package Manager."""
|
||||
|
||||
from abc import ABC, abstractmethod
|
||||
|
||||
from rwx import Object
|
||||
from rwx.ps import Command
|
||||
|
||||
|
||||
class PM(Object, ABC):
|
||||
"""Package Manager."""
|
||||
|
||||
def __init__(self) -> None:
|
||||
"""Set commands."""
|
||||
self.clean = self.get_clean_command()
|
||||
self.install = self.get_install_command()
|
||||
|
||||
@abstractmethod
|
||||
def get_clean_command(self) -> Command:
|
||||
"""Command to clean packages cache.
|
||||
|
||||
:rtype: Command
|
||||
"""
|
||||
|
||||
@abstractmethod
|
||||
def get_install_command(self) -> Command:
|
||||
"""Command to install package(s).
|
||||
|
||||
:rtype: Command
|
||||
"""
|
22
rwx/os/pm/apt.py
Normal file
22
rwx/os/pm/apt.py
Normal file
|
@ -0,0 +1,22 @@
|
|||
"""Advanced Package Tool."""
|
||||
|
||||
from rwx.os.pm import PM
|
||||
from rwx.ps import Command
|
||||
|
||||
|
||||
class APT(PM):
|
||||
"""Advanced Package Tool."""
|
||||
|
||||
def get_clean_command(self) -> Command:
|
||||
"""Return clean command.
|
||||
|
||||
:rtype: Command
|
||||
"""
|
||||
return Command()
|
||||
|
||||
def get_install_command(self) -> Command:
|
||||
"""Return install command.
|
||||
|
||||
:rtype: Command
|
||||
"""
|
||||
return Command()
|
Loading…
Add table
Add a link
Reference in a new issue