diff options
author | Helmut Grohne <helmut@subdivi.de> | 2021-06-15 13:36:34 +0200 |
---|---|---|
committer | Helmut Grohne <helmut@subdivi.de> | 2021-06-15 13:36:34 +0200 |
commit | 511c49acc13803d851a4d0d2ef17647e3e2144b4 (patch) | |
tree | 66604f5addb56b2502106ed1c764598aeea53d33 /mdbp/common.py | |
parent | d8b36aca8725b36411298961aa2494e995426417 (diff) | |
download | mdbp-511c49acc13803d851a4d0d2ef17647e3e2144b4.tar.gz |
allow passing custom options to pbuilder and sbuild
Diffstat (limited to 'mdbp/common.py')
-rw-r--r-- | mdbp/common.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/mdbp/common.py b/mdbp/common.py index 8b7f8c1..7a528bc 100644 --- a/mdbp/common.py +++ b/mdbp/common.py @@ -191,3 +191,13 @@ def clean_dir(directory: pathlib.Path, patterns: typing.List[str]) -> None: if not any(fnmatch.fnmatchcase(entry.name, pattern) for pattern in patterns): entry.unlink() + +class AddSpaceSeparatedValues(argparse.Action): + """The action extends the destination array with the space-sparated parts + of the passed value.""" + def __call__(self, parser: argparse.ArgumentParser, + namespace: argparse.Namespace, + values: typing.Union[str, typing.Sequence[typing.Any], None], + option_string: typing.Optional[str] = None) -> None: + assert isinstance(values, str) + getattr(namespace, self.dest).extend(values.split()) |