Merge "Upgrade the 'aday' script to python3."

This commit is contained in:
Treehugger Robot
2023-03-09 21:59:13 +00:00
committed by Gerrit Code Review

View File

@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
import datetime
import sys
@@ -8,7 +8,7 @@ def build_to_date(build):
day = int(build[3:5])
month = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.index(letter) * 3
year = 2009 + (month / 12)
year = 2009 + (month // 12)
month %= 12
return datetime.date(year, month + 1, 1) + datetime.timedelta(days=day - 1)
@@ -18,4 +18,4 @@ if __name__ == '__main__':
if len(sys.argv) != 2:
sys.exit('usage: aday BUILD_NUMBER')
print build_to_date(sys.argv[1])
print(build_to_date(sys.argv[1]))