diff --git a/repo_helper/files/ci_cd.py b/repo_helper/files/ci_cd.py index a74f362a..141deef2 100644 --- a/repo_helper/files/ci_cd.py +++ b/repo_helper/files/ci_cd.py @@ -594,9 +594,12 @@ def ensure_bumpversion(repo_path: pathlib.Path, templates: jinja2.Environment) - if "bumpversion:file:setup.cfg" in bv.sections(): setup_cfg_section = bv["bumpversion:file:setup.cfg"] - if "search" not in setup_cfg_section: - setup_cfg_section["search"] = "name = {current_version}" - setup_cfg_section["replace"] = "name = {new_version}" + if ( + "search" not in setup_cfg_section + or ("search" in setup_cfg_section and setup_cfg_section["search"] == "name = {current_version}") + ): + setup_cfg_section["search"] = "version = {current_version}" + setup_cfg_section["replace"] = "version = {new_version}" bv["bumpversion"]["current_version"] = templates.globals["version"] bv["bumpversion"]["commit"] = "True" diff --git a/tests/test_files/test_ci_cd_/test_ensure_bumpversion_py_modules0_False_False_py_versions0_.cfg b/tests/test_files/test_ci_cd_/test_ensure_bumpversion_py_modules0_False_False_py_versions0_.cfg index b4b5b424..26fd647c 100644 --- a/tests/test_files/test_ci_cd_/test_ensure_bumpversion_py_modules0_False_False_py_versions0_.cfg +++ b/tests/test_files/test_ci_cd_/test_ensure_bumpversion_py_modules0_False_False_py_versions0_.cfg @@ -16,5 +16,5 @@ replace = : str = "{new_version}" [bumpversion:file:repo_helper.yml] [bumpversion:file:setup.cfg] -search = name = {current_version} -replace = name = {new_version} +search = version = {current_version} +replace = version = {new_version} diff --git a/tests/test_files/test_ci_cd_/test_ensure_bumpversion_py_modules0_False_False_py_versions1_.cfg b/tests/test_files/test_ci_cd_/test_ensure_bumpversion_py_modules0_False_False_py_versions1_.cfg index b4b5b424..26fd647c 100644 --- a/tests/test_files/test_ci_cd_/test_ensure_bumpversion_py_modules0_False_False_py_versions1_.cfg +++ b/tests/test_files/test_ci_cd_/test_ensure_bumpversion_py_modules0_False_False_py_versions1_.cfg @@ -16,5 +16,5 @@ replace = : str = "{new_version}" [bumpversion:file:repo_helper.yml] [bumpversion:file:setup.cfg] -search = name = {current_version} -replace = name = {new_version} +search = version = {current_version} +replace = version = {new_version} diff --git a/tests/test_files/test_ci_cd_/test_ensure_bumpversion_py_modules0_False_True_py_versions0_.cfg b/tests/test_files/test_ci_cd_/test_ensure_bumpversion_py_modules0_False_True_py_versions0_.cfg index 78d8a82f..24ea6d1a 100644 --- a/tests/test_files/test_ci_cd_/test_ensure_bumpversion_py_modules0_False_True_py_versions0_.cfg +++ b/tests/test_files/test_ci_cd_/test_ensure_bumpversion_py_modules0_False_True_py_versions0_.cfg @@ -18,5 +18,5 @@ replace = : str = "{new_version}" [bumpversion:file:repo_helper.yml] [bumpversion:file:setup.cfg] -search = name = {current_version} -replace = name = {new_version} +search = version = {current_version} +replace = version = {new_version} diff --git a/tests/test_files/test_ci_cd_/test_ensure_bumpversion_py_modules0_False_True_py_versions1_.cfg b/tests/test_files/test_ci_cd_/test_ensure_bumpversion_py_modules0_False_True_py_versions1_.cfg index 78d8a82f..24ea6d1a 100644 --- a/tests/test_files/test_ci_cd_/test_ensure_bumpversion_py_modules0_False_True_py_versions1_.cfg +++ b/tests/test_files/test_ci_cd_/test_ensure_bumpversion_py_modules0_False_True_py_versions1_.cfg @@ -18,5 +18,5 @@ replace = : str = "{new_version}" [bumpversion:file:repo_helper.yml] [bumpversion:file:setup.cfg] -search = name = {current_version} -replace = name = {new_version} +search = version = {current_version} +replace = version = {new_version} diff --git a/tests/test_files/test_ci_cd_/test_ensure_bumpversion_py_modules1_False_False_py_versions0_.cfg b/tests/test_files/test_ci_cd_/test_ensure_bumpversion_py_modules1_False_False_py_versions0_.cfg index b4b5b424..26fd647c 100644 --- a/tests/test_files/test_ci_cd_/test_ensure_bumpversion_py_modules1_False_False_py_versions0_.cfg +++ b/tests/test_files/test_ci_cd_/test_ensure_bumpversion_py_modules1_False_False_py_versions0_.cfg @@ -16,5 +16,5 @@ replace = : str = "{new_version}" [bumpversion:file:repo_helper.yml] [bumpversion:file:setup.cfg] -search = name = {current_version} -replace = name = {new_version} +search = version = {current_version} +replace = version = {new_version} diff --git a/tests/test_files/test_ci_cd_/test_ensure_bumpversion_py_modules1_False_False_py_versions1_.cfg b/tests/test_files/test_ci_cd_/test_ensure_bumpversion_py_modules1_False_False_py_versions1_.cfg index b4b5b424..26fd647c 100644 --- a/tests/test_files/test_ci_cd_/test_ensure_bumpversion_py_modules1_False_False_py_versions1_.cfg +++ b/tests/test_files/test_ci_cd_/test_ensure_bumpversion_py_modules1_False_False_py_versions1_.cfg @@ -16,5 +16,5 @@ replace = : str = "{new_version}" [bumpversion:file:repo_helper.yml] [bumpversion:file:setup.cfg] -search = name = {current_version} -replace = name = {new_version} +search = version = {current_version} +replace = version = {new_version} diff --git a/tests/test_files/test_ci_cd_/test_ensure_bumpversion_py_modules1_False_True_py_versions0_.cfg b/tests/test_files/test_ci_cd_/test_ensure_bumpversion_py_modules1_False_True_py_versions0_.cfg index 78d8a82f..24ea6d1a 100644 --- a/tests/test_files/test_ci_cd_/test_ensure_bumpversion_py_modules1_False_True_py_versions0_.cfg +++ b/tests/test_files/test_ci_cd_/test_ensure_bumpversion_py_modules1_False_True_py_versions0_.cfg @@ -18,5 +18,5 @@ replace = : str = "{new_version}" [bumpversion:file:repo_helper.yml] [bumpversion:file:setup.cfg] -search = name = {current_version} -replace = name = {new_version} +search = version = {current_version} +replace = version = {new_version} diff --git a/tests/test_files/test_ci_cd_/test_ensure_bumpversion_py_modules1_False_True_py_versions1_.cfg b/tests/test_files/test_ci_cd_/test_ensure_bumpversion_py_modules1_False_True_py_versions1_.cfg index 78d8a82f..24ea6d1a 100644 --- a/tests/test_files/test_ci_cd_/test_ensure_bumpversion_py_modules1_False_True_py_versions1_.cfg +++ b/tests/test_files/test_ci_cd_/test_ensure_bumpversion_py_modules1_False_True_py_versions1_.cfg @@ -18,5 +18,5 @@ replace = : str = "{new_version}" [bumpversion:file:repo_helper.yml] [bumpversion:file:setup.cfg] -search = name = {current_version} -replace = name = {new_version} +search = version = {current_version} +replace = version = {new_version} diff --git a/tests/test_files/test_ci_cd_/test_ensure_bumpversion_remove_docs.cfg b/tests/test_files/test_ci_cd_/test_ensure_bumpversion_remove_docs.cfg index b4b5b424..26fd647c 100644 --- a/tests/test_files/test_ci_cd_/test_ensure_bumpversion_remove_docs.cfg +++ b/tests/test_files/test_ci_cd_/test_ensure_bumpversion_remove_docs.cfg @@ -16,5 +16,5 @@ replace = : str = "{new_version}" [bumpversion:file:repo_helper.yml] [bumpversion:file:setup.cfg] -search = name = {current_version} -replace = name = {new_version} +search = version = {current_version} +replace = version = {new_version}