Skip to content

Commit b2f29e9

Browse files
committed
update_python_version.py: Use local date
1 parent de3695d commit b2f29e9

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

‎scripts/update_python_version.py‎

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import sys
88
import os
99
import subprocess
10+
from datetime import datetime
1011

1112
argparser = argparse.ArgumentParser(description=__doc__)
1213
argparser.add_argument('itkSourceDir')
@@ -21,11 +22,17 @@
2122

2223

2324
os.chdir(itkSourceDir)
24-
# "2017-02-08 15:21:09 -0500"
25+
# "Wed Feb 8 15:21:09 2017"\n
2526
commitDate = subprocess.check_output(['git',
26-
'show', '-s', '--date=local', '--format="%ci"'])
27+
'show', '-s', '--date=local', '--format="%cd"'])
28+
# Wed Feb 8 15:21:09 2017
29+
commitDate = commitDate.strip()[1:-1]
30+
# Wed Feb 08 15:21:09 2017
31+
commitDate = commitDate.split(' ')
32+
commitDate[2] = '{:02d}'.format(int(commitDate[2]))
33+
commitDate = ' '.join(commitDate)
2734
# 2017-02-08
28-
commitDateDashes = commitDate.split()[0][1:]
35+
commitDateDashes = datetime.strptime(commitDate, "%a %b %d %H:%M:%S %Y").strftime("%Y-%m-%d")
2936
# 20170208
3037
commitDate = commitDateDashes.replace('-', '')
3138

0 commit comments

Comments
 (0)