You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ch...@apache.org on 2025/01/09 08:55:43 UTC
(lucene) branch branch_10x updated: Updated releaseWizard.py to use timezone-aware objects to represent datetimes in UTC (#14102)
This is an automated email from the ASF dual-hosted git repository.
chegar pushed a commit to branch branch_10x
in repository https://gitbox.apache.org/repos/asf/lucene.git
The following commit(s) were added to refs/heads/branch_10x by this push:
new 84be80f21b2 Updated releaseWizard.py to use timezone-aware objects to represent datetimes in UTC (#14102)
84be80f21b2 is described below
commit 84be80f21b2e46c1ae6abaad821a3ffda57e6b2a
Author: Shubham Sharma <f2...@hyderabad.bits-pilani.ac.in>
AuthorDate: Thu Jan 9 14:23:54 2025 +0530
Updated releaseWizard.py to use timezone-aware objects to represent datetimes in UTC (#14102)
Co-authored-by: Shubham Sharma <sh...@gmail.com>
---
dev-tools/scripts/releaseWizard.py | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)
diff --git a/dev-tools/scripts/releaseWizard.py b/dev-tools/scripts/releaseWizard.py
index d599095619d..3814ae38a78 100755
--- a/dev-tools/scripts/releaseWizard.py
+++ b/dev-tools/scripts/releaseWizard.py
@@ -49,6 +49,7 @@ import urllib
from collections import OrderedDict
from datetime import datetime
from datetime import timedelta
+from datetime import timezone
try:
import holidays
@@ -99,7 +100,7 @@ def expand_jinja(text, vars=None):
'state': state,
'gpg_key' : state.get_gpg_key(),
'gradle_cmd' : 'gradlew.bat' if is_windows() else './gradlew',
- 'epoch': unix_time_millis(datetime.utcnow()),
+ 'epoch': unix_time_millis(datetime.now(tz=timezone.utc)),
'get_next_version': state.get_next_version(),
'current_git_rev': state.get_current_git_rev(),
'keys_downloaded': keys_downloaded(),
@@ -199,7 +200,7 @@ def check_prerequisites(todo=None):
return True
-epoch = datetime.utcfromtimestamp(0)
+epoch = datetime.fromtimestamp(timestamp=0, tz=timezone.utc)
def unix_time_millis(dt):
@@ -279,7 +280,7 @@ class ReleaseState:
self.latest_version = None
self.previous_rcs = {}
self.rc_number = 1
- self.start_date = unix_time_millis(datetime.utcnow())
+ self.start_date = unix_time_millis(datetime.now(tz=timezone.utc))
self.script_branch = run("git rev-parse --abbrev-ref HEAD").strip()
self.mirrored_versions = None
try:
@@ -741,7 +742,7 @@ class Todo(SecretYamlObject):
def set_done(self, is_done):
if is_done:
- self.state['done_date'] = unix_time_millis(datetime.utcnow())
+ self.state['done_date'] = unix_time_millis(datetime.now(tz=timezone.utc))
if self.persist_vars:
for k in self.persist_vars:
self.state[k] = self.get_vars()[k]
@@ -935,7 +936,7 @@ def expand_multiline(cmd_txt, indent=0):
def unix_to_datetime(unix_stamp):
- return datetime.utcfromtimestamp(unix_stamp / 1000)
+ return datetime.fromtimestamp(timestamp=unix_stamp / 1000, tz=timezone.utc)
def generate_asciidoc():
@@ -949,7 +950,7 @@ def generate_asciidoc():
fh.write("= Lucene Release %s\n\n" % state.release_version)
fh.write("(_Generated by releaseWizard.py v%s at %s_)\n\n"
- % (getScriptVersion(), datetime.utcnow().strftime("%Y-%m-%d %H:%M UTC")))
+ % (getScriptVersion(), datetime.now(tz=timezone.utc).strftime("%Y-%m-%d %H:%M UTC")))
fh.write(":numbered:\n\n")
fh.write("%s\n\n" % template('help'))
for group in state.todo_groups:
@@ -1839,9 +1840,9 @@ def create_ical(todo): # pylint: disable=unused-argument
return True
-today = datetime.utcnow().date()
+today = datetime.now(tz=timezone.utc).date()
sundays = {(today + timedelta(days=x)): 'Sunday' for x in range(10) if (today + timedelta(days=x)).weekday() == 6}
-y = datetime.utcnow().year
+y = datetime.now(tz=timezone.utc).year
years = [y, y+1]
non_working = holidays.CA(years=years) + holidays.US(years=years) + holidays.UK(years=years) \
+ holidays.DE(years=years) + holidays.NO(years=years) + holidays.IN(years=years) + holidays.RU(years=years)
@@ -1849,7 +1850,7 @@ non_working = holidays.CA(years=years) + holidays.US(years=years) + holidays.UK(
def vote_close_72h_date():
# Voting open at least 72 hours according to ASF policy
- return datetime.utcnow() + timedelta(hours=73)
+ return datetime.now(tz=timezone.utc) + timedelta(hours=73)
def vote_close_72h_holidays():