Skip to content

Commit

Permalink
Support to new X.Y version number strategy starting from new upcommin…
Browse files Browse the repository at this point in the history
…g 10 version (resolve dalibo#64)
  • Loading branch information
fabriziomello committed Jun 6, 2017
1 parent ee3da10 commit 4d402bf
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions pgactivity/Data.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,16 +212,19 @@ def pg_get_num_version(self, text_version):
a string (SELECT version()).
"""
res = re.match(
r"^(PostgreSQL|EnterpriseDB) ([0-9]+)\.([0-9]+)\.([0-9]+)",
r"^(PostgreSQL|EnterpriseDB) ([0-9]+)\.([0-9]+)(?:\.([0-9]+))?",
text_version)
if res is not None:
rmatch = res.group(2)
if int(res.group(3)) < 10:
rmatch += '0'
rmatch += res.group(3)
if int(res.group(4)) < 10:
rmatch += '0'
rmatch += res.group(4)
if res.group(4) is not None:
if int(res.group(4)) < 10:
rmatch += '0'
rmatch += res.group(4)
else:
rmatch += '00'
self.pg_version = str(res.group(0))
self.pg_num_version = int(rmatch)
return
Expand All @@ -233,13 +236,16 @@ def pg_get_num_dev_version(self, text_version):
from a string (SELECT version()).
"""
res = re.match(
r"^(PostgreSQL|EnterpriseDB) ([0-9]+)\.([0-9]+)(devel|beta[0-9]+|rc[0-9]+)",
r"^(PostgreSQL|EnterpriseDB) ([0-9]+)(?:\.([0-9]+))?(devel|beta[0-9]+|rc[0-9]+)",
text_version)
if res is not None:
rmatch = res.group(2)
if int(res.group(3)) < 10:
rmatch += '0'
rmatch += res.group(3)
if res.group(3) is not None:
if int(res.group(3)) < 10:
rmatch += '0'
rmatch += res.group(3)
else:
rmatch += '00'
rmatch += '00'
self.pg_version = str(res.group(0))
self.pg_num_version = int(rmatch)
Expand Down

0 comments on commit 4d402bf

Please sign in to comment.