diff --git a/docs/configuration.rst b/docs/configuration.rst index 78e20d183..aa904dc9d 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -1347,7 +1347,8 @@ The regular expression generated from the ``version_variables`` definition will: 2. The variable name defined by ``variable`` and the version must be separated by an operand symbol (``=``, ``:``, ``:=``, or ``@``). Whitespace is optional around - the symbol. + the symbol. As of $NEW_VERSION, a double-equals (``==``) operator is also supported + as a valid operand symbol. 3. The value of the variable must match a `SemVer`_ regular expression and can be enclosed by single (``'``) or double (``"``) quotation marks but they must match. However, @@ -1400,6 +1401,9 @@ will be matched and replaced by the new version: # Custom Tag Format with tag_format set (monorepos) __release__ = "module-v1.2.3" + # requirements.txt + my-package == 1.2.3 + .. important:: The Regular Expression expects a version value to exist in the file to be replaced. It cannot be an empty string or a non-semver compliant string. If this is the very diff --git a/src/semantic_release/version/declarations/pattern.py b/src/semantic_release/version/declarations/pattern.py index 55873ce0a..e96234117 100644 --- a/src/semantic_release/version/declarations/pattern.py +++ b/src/semantic_release/version/declarations/pattern.py @@ -230,9 +230,9 @@ def from_string_definition( # Supports optional matching quotations around variable name # Negative lookbehind to ensure we don't match part of a variable name f"""(?x)(?P['"])?(?['"])?{value_replace_pattern_str}(?P=quote2)?""", ], diff --git a/tests/unit/semantic_release/version/declarations/test_pattern_declaration.py b/tests/unit/semantic_release/version/declarations/test_pattern_declaration.py index fd7cb7dad..8280e95bb 100644 --- a/tests/unit/semantic_release/version/declarations/test_pattern_declaration.py +++ b/tests/unit/semantic_release/version/declarations/test_pattern_declaration.py @@ -165,6 +165,15 @@ def test_pattern_declaration_is_version_replacer(): """if version := '1.0.0': """, f"""if version := '{next_version}': """, ), + ( + "Explicit number format for requirements.txt file with double equals", + f"{test_file}:my-package:{VersionStampType.NUMBER_FORMAT.value}", + # irrelevant for this case + lazy_fixture(default_tag_format_str.__name__), + # Uses double equals separator + """my-package == 1.0.0""", + f"""my-package == {next_version}""", + ), ( "Using default number format for multi-line & quoted json", f"{test_file}:version:{VersionStampType.NUMBER_FORMAT.value}", pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy