specfile.options
Token
class Token(collections.abc.Hashable)
Class that represents a single token in an option string.
Attributes:
type
- Token type.value
- Token value.
Positionals
class Positionals(collections.abc.MutableSequence)
Class that represents a sequence of positional arguments.
__init__
def __init__(options: "Options") -> None
Initializes a positionals object.
Arguments:
options
-Options
instance this object is tied with.
insert
def insert(i: int, value: Union[int, str]) -> None
Inserts a new positional argument at the specified index.
Arguments:
i
- Requested index.value
- Value of the positional argument.
Options
class Options(collections.abc.MutableMapping)
Class that represents macro options.
Attributes:
optstring
- getopt-like option string containing recognized option characters. Option characters are ASCII letters, upper or lower-case. If such a character is followed by a colon, the option requires an argument.defaults
- Dict specifying default arguments to options.
__init__
def __init__(
tokens: List[Token],
optstring: Optional[str] = None,
defaults: Optional[Dict[str, Union[bool, int, str]]] = None) -> None
Initializes an options object.
Arguments:
tokens
- List of tokens in an option string.optstring
- String containing recognized option characters. Option characters are ASCII letters, upper or lower-case. If such a character is followed by a colon, the option requires an argument.defaults
- Dict specifying default arguments to options.
positional
@property
def positional() -> Positionals
Sequence of positional arguments.
tokenize
@staticmethod
def tokenize(option_string: str) -> List[Token]
Tokenizes an option string.
Follows the same rules as poptParseArgvString()
that is used by RPM.
Arguments:
option_string
- Option string.
Returns:
List of tokens.
Raises:
OptionsException
- If the option string is untokenizable.