mbarkhau / bumpver

BumpVer: Automatic Versioning
https://github.com/mbarkhau/bumpver
MIT License
182 stars 34 forks source link

Fix pathlib issues #219

Closed mbarkhau closed 1 year ago

mbarkhau commented 1 year ago

Fixes #204 #218

SRFU-NN commented 1 year ago

This fixes the problem for me.

A rough test that fails if the problem is there, and passes when it is fixed:

from bumpver import config

def test_capitalisation():
    filename_list = [
        'test/temp/CAPITALIZED.txt',
        'test/temp/uncapitalized.txt',    
    ]
    for filename in filename_list:
        with open(filename,"w") as f:
            f.write("This is a test file for testing capitalization")
    raw_patterns = {filename: filename for filename in filename_list}
    for file_pattern in config._iter_glob_expanded_file_patterns(raw_patterns):
        filtered_pattern = file_pattern[0]
        filtered_pattern = filtered_pattern.replace("\\","/")
        unfiltered_pattern = file_pattern[1]
        assert filtered_pattern == unfiltered_pattern

Note that the test leaves the folder test\temp with contents behind, so it isn't production ready.

Also note that when I try to run bumpver update --patch in the repo, it complains that it can't find the patterns in the files src/bumpver/hooks.py and src/bumpver/pathlib.py, because they lack the copyright notice at the start that contains the pattern src/bumpver/*.py = Copyright (c) 2018-YYYY. I am not sure what the "correct" action is when using wildcards in filenames, and only some of the matching files contain the pattern, but it is worth to consider.

SRFU-NN commented 1 year ago

If you need a more formal review from me, I need access to make them.

mbarkhau commented 1 year ago

No, that's fine. I'll look over your test, add it if I can and then I think we're good to go for a release.