Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev #104

Merged
merged 2 commits into from
Jun 21, 2023
Merged

Dev #104

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from mobros.types.mobros_global_data import GlobalData
from mobros.types.apt_cache_singleton import AptCache
from mobros.exceptions import AptCacheInitializationException
from mobros.constants import Commands

def check_if_requested_packages_are_in_desired_state(install_pkgs):
""" Quick check if the requested packages are already in the desired state
Expand Down Expand Up @@ -296,7 +297,8 @@ def execute(self, args):
sys.exit(1)

install_pkgs = args.pkg_list
del install_pkgs[0]
if Commands.INSTALL.value in install_pkgs:
install_pkgs.remove(Commands.INSTALL.value)

if not install_pkgs:
logging.userInfo("No packages mentioned. Nothing todo.")
Expand Down
11 changes: 11 additions & 0 deletions mobros/constants.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Module to place all the package constants used throughout the package"""
from os import environ
from enum import Enum
from mobros import __version__
MOBROS_VERSION = __version__.version

Expand Down Expand Up @@ -45,3 +46,13 @@
"version_gt": ">",
"any": "any",
}

class Commands(Enum):
"""Commands enumerate"""
INSTALL = "install"
INSTALL_BUILD_DEPS = "install-build-dependencies"
BUILD = "build"
PACK = "pack"
PUBLISH = "publish"
RAISE = "raise"
PING = "ping"
18 changes: 9 additions & 9 deletions mobros/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@
from mobros.commands.ros_pack.pack_executer import RosPackExecuter
from mobros.commands.ros_raise.raise_executer import RosRaiseExecuter
from mobros.commands.ros_rosdep_publish.rosdep_pub_executer import RosdepPublishExecuter
from mobros.constants import MOBROS_VERSION
from mobros.constants import MOBROS_VERSION, Commands

executors = {
"install-build-dependencies": InstallBuildDependsExecuter,
"build": RosBuildExecuter,
"pack": RosPackExecuter,
"install": InstallRuntimeDependsExecuter,
"publish": RosdepPublishExecuter,
"raise": RosRaiseExecuter,
"ping": PingExecuter,
Commands.INSTALL_BUILD_DEPS.value: InstallBuildDependsExecuter,
Commands.BUILD.value: RosBuildExecuter,
Commands.PACK.value: RosPackExecuter,
Commands.INSTALL.value: InstallRuntimeDependsExecuter,
Commands.PUBLISH.value: RosdepPublishExecuter,
Commands.RAISE.value: RosRaiseExecuter,
Commands.PING.value: PingExecuter,
}

def handle():
Expand All @@ -49,7 +49,7 @@ def handle():

command = ns.command

if command != "ping":
if command != Commands.PING.value:
logging.userInfo("Mobros version: "+MOBROS_VERSION)

h = ns.h
Expand Down