baseimage-tutorial-framework/lib/tfw/components/commands_equal.py

20 lines
489 B
Python
Raw Normal View History

# Copyright (C) 2018 Avatao.com Innovative Learning Kft.
# All Rights Reserved. See LICENSE file for details.
from shlex import split
class CommandsEqual:
def __init__(self, command_1, command_2):
self.command_1 = command_1
self.command_2 = command_2
def __bool__(self):
parts_1 = split(self.command_1)
parts_2 = split(self.command_2)
return (
parts_1[0] == parts_2[0]
and set(parts_1) == set(parts_2)
)