summaryrefslogtreecommitdiff
path: root/bin/update-release-info.py
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2019-07-24 09:57:09 +0200
committerJörg Frings-Fürst <debian@jff-webhosting.net>2019-07-24 09:57:09 +0200
commitc7665433b2004d2b404d6fb9d6fd064998486f63 (patch)
tree8525ef6d24f7c6ceb238945ebb2cc997c7afc905 /bin/update-release-info.py
parente48d2727885efda8369c7edbc2e3929a59532adc (diff)
parent6e228c305122f0564eda1e67d56651f8386d24d7 (diff)
Merge branch 'release/debian/3.1.0+repack-1'debian/3.1.0+repack-1
Diffstat (limited to 'bin/update-release-info.py')
-rw-r--r--bin/update-release-info.py43
1 files changed, 24 insertions, 19 deletions
diff --git a/bin/update-release-info.py b/bin/update-release-info.py
index a4096d1..c2b3d19 100644
--- a/bin/update-release-info.py
+++ b/bin/update-release-info.py
@@ -20,10 +20,10 @@ in various files:
- The RELEASE header line in src/CHANGES.txt and src/Announce.txt.
- The version string at the top of src/RELEASE.txt.
- The version string in the 'default_version' variable in SConstruct
- and QMTest/TestSCons.py.
- - The copyright years in SConstruct and QMTest/TestSCons.py.
+ and testing/framework/TestSCons.py.
+ - The copyright years in SConstruct and testing/framework/TestSCons.py.
- The month and year (used for documentation) in SConstruct.
- - The unsupported and deprecated Python floors in QMTest/TestSCons.py
+ - The unsupported and deprecated Python floors in testing/framework/TestSCons.py
and src/engine/SCons/Script/Main.py
- The version string in the filenames in README.
@@ -36,7 +36,7 @@ In 'post' mode, files are prepared for the next release cycle:
src/Announce.txt.
"""
#
-# Copyright (c) 2001 - 2017 The SCons Foundation
+# Copyright (c) 2001 - 2019 The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -58,7 +58,7 @@ In 'post' mode, files are prepared for the next release cycle:
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
from __future__ import print_function
-__revision__ = "bin/update-release-info.py rel_3.0.0:4395:8972f6a2f699 2017/09/18 12:59:24 bdbaddog"
+__revision__ = "bin/update-release-info.py e724ae812eb96f4858a132f5b8c769724744faf6 2019-07-21 00:04:47 bdeegan"
import os
import sys
@@ -81,7 +81,10 @@ else:
# Get configuration information
config = dict()
-exec(open('ReleaseConfig').read(), globals(), config)
+with open('ReleaseConfig') as f:
+ releaseconfig = f.read()
+exec(releaseconfig, globals(), config)
+
try:
version_tuple = config['version_tuple']
@@ -152,7 +155,8 @@ class UpdateFile(object):
'''
if orig is None: orig = file
try:
- self.content = open(orig, 'r').read()
+ with open(orig, 'r') as f:
+ self.content = f.read()
except IOError:
# Couldn't open file; don't try to write anything in __del__
self.file = None
@@ -180,8 +184,8 @@ class UpdateFile(object):
# Determine the pattern to match a version
- _rel_types = '(alpha|beta|candidate|final)'
- match_pat = '\d+\.\d+\.\d+\.' + _rel_types + '\.(\d+|yyyymmdd)'
+ _rel_types = r'(alpha|beta|candidate|final)'
+ match_pat = r'\d+\.\d+\.\d+\.' + _rel_types + r'\.(\d+|yyyymmdd)'
match_rel = re.compile(match_pat)
def replace_version(self, replacement = version_string, count = 1):
@@ -198,14 +202,14 @@ class UpdateFile(object):
new_date = 'NEW DATE WILL BE INSERTED HERE'
else:
min = (time.daylight and time.altzone or time.timezone)//60
- hr = min//60
- min = -(min%60 + hr*100)
+ hr = min // 60
+ min = -(min % 60 + hr * 100)
new_date = (time.strftime('%a, %d %b %Y %X', release_date + (0,0,0))
+ ' %+.4d' % min)
- _days = '(Sun|Mon|Tue|Wed|Thu|Fri|Sat)'
- _months = '(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oce|Nov|Dec)'
- match_date = _days+', \d\d '+_months+' \d\d\d\d \d\d:\d\d:\d\d [+-]\d\d\d\d'
+ _days = r'(Sun|Mon|Tue|Wed|Thu|Fri|Sat)'
+ _months = r'(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oce|Nov|Dec)'
+ match_date = r''.join([_days, r', \d\d ', _months, r' \d\d\d\d \d\d:\d\d:\d\d [+-]\d\d\d\d'])
match_date = re.compile(match_date)
def replace_date(self, replacement = new_date, count = 1):
@@ -220,7 +224,8 @@ class UpdateFile(object):
'''
if self.file is not None and self.content != self.orig:
print('Updating ' + self.file + '...')
- open(self.file, 'w').write(self.content)
+ with open(self.file, 'w') as f:
+ f.write(self.content)
if mode == 'post':
# Set up for the next release series.
@@ -309,15 +314,15 @@ t.replace_assign('default_version', repr(version_string))
t = UpdateFile('README.rst')
if DEBUG: t.file = '/tmp/README.rst'
-t.sub('-' + t.match_pat + '\.', '-' + version_string + '.', count = 0)
+t.sub('-' + t.match_pat + r'\.', '-' + version_string + '.', count = 0)
for suf in ['tar', 'win32', 'zip', 'rpm', 'exe', 'deb']:
- t.sub('-(\d+\.\d+\.\d+)\.%s' % suf,
+ t.sub(r'-(\d+\.\d+\.\d+)\.%s' % suf,
'-%s.%s' % (version_string, suf),
count = 0)
-# Update QMTest/TestSCons.py
+# Update testing/framework/TestSCons.py
-t = UpdateFile(os.path.join('QMTest', 'TestSCons.py'))
+t = UpdateFile(os.path.join('testing','framework', 'TestSCons.py'))
if DEBUG: t.file = '/tmp/TestSCons.py'
t.replace_assign('copyright_years', repr(copyright_years))
t.replace_assign('default_version', repr(version_string))