[python3.12] Fix syntax warnings in utils.py scripts

Bug: https://github.com/dart-lang/sdk/issues/54306
Change-Id: I3abfac0765721246b59451152d322a111d685644
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/346022
Commit-Queue: William Hesse <whesse@google.com>
Reviewed-by: William Hesse <whesse@google.com>
Auto-Submit: Alexander Thomas <athom@google.com>
This commit is contained in:
Alexander Thomas 2024-01-12 16:38:51 +00:00 committed by Commit Queue
parent a5758a0dc3
commit a100968232
2 changed files with 8 additions and 7 deletions

View file

@ -60,7 +60,7 @@ def GuessCpus():
if os.path.exists("/usr/bin/hostinfo"):
return int(
getoutput(
'/usr/bin/hostinfo | GREP_OPTIONS= grep "processors are logically available." | awk "{ print \$1 }"'
'/usr/bin/hostinfo | GREP_OPTIONS= grep "processors are logically available." | awk "{ print \\$1 }"'
))
win_cpu_count = os.getenv("NUMBER_OF_PROCESSORS")
if win_cpu_count:

View file

@ -307,7 +307,7 @@ def GuessCpus():
subprocess.check_output(
'/usr/bin/hostinfo |'
' grep "processors are logically available." |'
' awk "{ print \$1 }"',
' awk "{ print \\$1 }"',
shell=True))
win_cpu_count = os.getenv("NUMBER_OF_PROCESSORS")
if win_cpu_count:
@ -398,11 +398,11 @@ def ReadVersionFile(version_file=None):
return None
channel = match_against('^CHANNEL ([A-Za-z0-9]+)$', content)
major = match_against('^MAJOR (\d+)$', content)
minor = match_against('^MINOR (\d+)$', content)
patch = match_against('^PATCH (\d+)$', content)
prerelease = match_against('^PRERELEASE (\d+)$', content)
prerelease_patch = match_against('^PRERELEASE_PATCH (\d+)$', content)
major = match_against('^MAJOR (\\d+)$', content)
minor = match_against('^MINOR (\\d+)$', content)
patch = match_against('^PATCH (\\d+)$', content)
prerelease = match_against('^PRERELEASE (\\d+)$', content)
prerelease_patch = match_against('^PRERELEASE_PATCH (\\d+)$', content)
if (channel and major and minor and prerelease and prerelease_patch):
return Version(channel, major, minor, patch, prerelease,
@ -1009,6 +1009,7 @@ def Main():
print('IsWindows() -> ', IsWindows())
print('GetGitRevision() -> ', GetGitRevision())
print('GetGitTimestamp() -> ', GetGitTimestamp())
print('ReadVersionFile() -> ', ReadVersionFile())
if __name__ == '__main__':