Skip to content

scripts/eachdist.py dependency version search is not strict enough #5227

@xrmx

Description

@xrmx

The regex in update_dependencies is not strict enough and opentelemetry-proto-json get also the opentelemetry-proto substitution.

This seems to do the trick:

diff --git a/scripts/eachdist.py b/scripts/eachdist.py
index c5f5e9880..a0775405f 100755
--- a/scripts/eachdist.py
+++ b/scripts/eachdist.py
@@ -601,7 +601,7 @@ def update_dependencies(targets, version, packages):
     operators_pattern = "|".join(re.escape(op) for op in operators)
 
     for pkg in packages:
-        search = rf"({basename(pkg)}[^,]*)({operators_pattern})(.*\.dev)"
+        search = rf"({basename(pkg)}\s[^,]*)({operators_pattern})(.*\.dev)"
         replace = r"\1\2 " + version
         update_files(
             targets,
@@ -618,7 +618,7 @@ def update_patch_dependencies(targets, version, prev_version, packages):
     operators_pattern = "|".join(re.escape(op) for op in operators)
 
     for pkg in packages:
-        search = rf"({basename(pkg)}[^,]*?)(\s?({operators_pattern})\s?)(.*{prev_version})"
+        search = rf"({basename(pkg)}\s[^,]*?)(\s?({operators_pattern})\s?)(.*{prev_version})"
         replace = r"\g<1>\g<2>" + version
         print(f"{search=}\t{replace=}\t{pkg=}")
         update_files(

The strange thing is that the bump on the release branch failed but the bump on main was correct.

To test this locally need to bump versions in eachdist.ini and then run ./scripts/eachdist.py update_versions --versions stable,prerelease

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions