diff options
author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2017-02-12 20:02:51 +0300 |
---|---|---|
committer | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2017-02-16 20:01:04 +0300 |
commit | e1da72b59c6ac5136f45709a0aa73dd5a296b2ff (patch) | |
tree | 71727a65c1fb7275a9477e06929c6f6638f64545 /utils/bump_version.py | |
parent | c4fc6113382969d41caa2e78cccfba2a5c7507a0 (diff) |
Reduce DeprecationWarnings for regexp
Diffstat (limited to 'utils/bump_version.py')
-rwxr-xr-x | utils/bump_version.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/utils/bump_version.py b/utils/bump_version.py index 617c33c0c..95db65ea7 100755 --- a/utils/bump_version.py +++ b/utils/bump_version.py @@ -29,9 +29,9 @@ def bump_version(path, version_info): with open(path, 'r+') as f: body = f.read() - body = re.sub("(?<=__version__ = ')[^']+", version, body) - body = re.sub("(?<=__released__ = ')[^']+", release, body) - body = re.sub("(?<=version_info = )\(.*\)", str(version_info), body) + body = re.sub(r"(?<=__version__ = ')[^']+", version, body) + body = re.sub(r"(?<=__released__ = ')[^']+", release, body) + body = re.sub(r"(?<=version_info = )\(.*\)", str(version_info), body) f.seek(0) f.truncate(0) @@ -39,23 +39,23 @@ def bump_version(path, version_info): def parse_version(version): - matched = re.search('^(\d+)\.(\d+)$', version) + matched = re.search(r'^(\d+)\.(\d+)$', version) if matched: major, minor = matched.groups() return (int(major), int(minor), 0, 'final', 0) - matched = re.search('^(\d+)\.(\d+)\.(\d+)$', version) + matched = re.search(r'^(\d+)\.(\d+)\.(\d+)$', version) if matched: major, minor, rev = matched.groups() return (int(major), int(minor), int(rev), 'final', 0) - matched = re.search('^(\d+)\.(\d+)\s*(a|b|alpha|beta)(\d+)$', version) + matched = re.search(r'^(\d+)\.(\d+)\s*(a|b|alpha|beta)(\d+)$', version) if matched: major, minor, typ, relver = matched.groups() release = RELEASE_TYPE.get(typ, typ) return (int(major), int(minor), 0, release, int(relver)) - matched = re.search('^(\d+)\.(\d+)\.(\d+)\s*(a|b|alpha|beta)(\d+)$', version) + matched = re.search(r'^(\d+)\.(\d+)\.(\d+)\s*(a|b|alpha|beta)(\d+)$', version) if matched: major, minor, rev, typ, relver = matched.groups() release = RELEASE_TYPE.get(typ, typ) @@ -90,7 +90,7 @@ class Changes(object): def fetch_version(self): with open(self.path) as f: version = f.readline().strip() - matched = re.search('^Release (.*) \((.*)\)$', version) + matched = re.search(r'^Release (.*) \((.*)\)$', version) if matched is None: raise RuntimeError('Unknown CHANGES format: %s' % version) |