diff options
author | Jon Turney <jon.turney@dronecode.org.uk> | 2023-04-23 17:06:59 +0300 |
---|---|---|
committer | Jon Turney <jon.turney@dronecode.org.uk> | 2023-04-28 21:22:54 +0300 |
commit | 2e43c60ad1c72bfac6daea9653a6174e3c1b5925 (patch) | |
tree | 158acda258e230c86d93662a7aed6663ee0eca3d | |
parent | 5caba5cdb6d9f2c17c552ea9e711dbda6ebe0779 (diff) |
Enhance fix-requires-by-path to match paths against a regex
-rw-r--r-- | calm/fix-requires-by-path.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/calm/fix-requires-by-path.py b/calm/fix-requires-by-path.py index 19b2f71..31d86e7 100644 --- a/calm/fix-requires-by-path.py +++ b/calm/fix-requires-by-path.py @@ -63,7 +63,7 @@ def fix_one_hint(args, dirpath, hintfile, tf): try: with xtarfile.open(os.path.join(dirpath, tf), mode='r') as a: - ivp = any(m.startswith(args.path) for m in a.getnames()) + ivp = any(re.match(args.path, m) for m in a.getnames()) except tarfile.ReadError: pass @@ -105,7 +105,7 @@ if __name__ == "__main__": relarea_default = common_constants.FTP parser = argparse.ArgumentParser(description='Add DEPATOM to requires: of packages which contain a file starting with PATH') - parser.add_argument('path', metavar='PATH', help='path to match') + parser.add_argument('path', metavar='PATH', help='regex of path to match') parser.add_argument('requires', metavar='DEPATOM', help='require to add') parser.add_argument('-v', '--verbose', action='count', dest='verbose', help='verbose output', default=0) parser.add_argument('--releasearea', action='store', metavar='DIR', help="release directory (default: " + relarea_default + ")", default=relarea_default, dest='relarea') |