Skip to content

Commit f3a9969

Browse files
committed
simplify
1 parent 4469bee commit f3a9969

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

python/private/version.bzl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -782,9 +782,11 @@ def version(version_str, strict = False):
782782
]
783783

784784
for p, fn in fns:
785+
start = len(parser.context()["norm"])
785786
fn(parser)
786-
parts[p] = parser.context()["norm"]
787-
parser.context()["norm"] = "" # Clear out the buffer so that it is easy to separate the fields
787+
parts[p] = parser.context()["norm"][start:]
788+
789+
parts["norm"] = parser.context()["norm"]
788790

789791
is_prefix = version_str.endswith(".*")
790792
parts["is_prefix"] = is_prefix
@@ -805,5 +807,4 @@ def version(version_str, strict = False):
805807
# If we fail to parse the version return None
806808
return None
807809

808-
parts["norm"] = "".join([parts[p] for p, _ in fns])
809810
return _new_version(**parts)

0 commit comments

Comments
 (0)