c2a: make Rust version matchin regex less exact

Allow custom version like 1.65.0.p1 (added in aosp/2404317).

Resolves warning:
WARNING: cannot find RustDefaultVersion in
development/scripts/../../build/soong/rust/config/global.go
Change-Id: I6fced7695473e025b0f739f9986df932d2c3f5fe

Test: cargo2android.py --config cargo2android.py
no warning

Change-Id: I43ff81f061477fc0322f27fef1c950954130dbc6
This commit is contained in:
Jeff Vander Stoep
2023-02-01 14:09:58 +01:00
parent 6e50b8e094
commit b06dd5c7e2

View File

@@ -1201,7 +1201,7 @@ class Runner(object):
if os.path.isfile(path2global): if os.path.isfile(path2global):
# try to find: RustDefaultVersion = "1.44.0" # try to find: RustDefaultVersion = "1.44.0"
version_pat = re.compile( version_pat = re.compile(
r'\s*RustDefaultVersion\s*=\s*"([0-9]+\.[0-9]+\.[0-9]+)".*$') r'\s*RustDefaultVersion\s*=\s*"([0-9]+\.[0-9]+\.[0-9]+).*"')
with open(path2global, 'r') as inf: with open(path2global, 'r') as inf:
for line in inf: for line in inf:
result = version_pat.match(line) result = version_pat.match(line)