diff --git a/bumpversion/config/utils.py b/bumpversion/config/utils.py index 7b844411..729fba8e 100644 --- a/bumpversion/config/utils.py +++ b/bumpversion/config/utils.py @@ -3,10 +3,11 @@ from __future__ import annotations import fnmatch -import glob import re from typing import Dict, List, Pattern +from wcmatch import glob + from bumpversion.config.models import FileChange from bumpversion.exceptions import BumpVersionError from bumpversion.versioning.models import VersionComponentSpec @@ -76,10 +77,9 @@ def resolve_glob_files(file_cfg: FileChange) -> List[FileChange]: A list of resolved file configurations according to the pattern. """ files: List[FileChange] = [] - exclude_matcher = glob_exclude_pattern(file_cfg.glob_exclude or []) - for filename_glob in glob.glob(file_cfg.glob, recursive=True): - if exclude_matcher.match(filename_glob): - continue + exclude = file_cfg.glob_exclude or [] + glob_flags = glob.GLOBSTAR | glob.FORCEUNIX + for filename_glob in glob.glob(file_cfg.glob, flags=glob_flags, exclude=exclude): new_file_cfg = file_cfg.model_copy() new_file_cfg.filename = filename_glob new_file_cfg.glob = None diff --git a/pyproject.toml b/pyproject.toml index 452691a3..3fb4ba18 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -39,6 +39,7 @@ dependencies = [ "rich-click", "rich", "tomlkit", + "wcmatch>=8.5.1", ] [project.scripts]