From 43d727c78a409dbe223a71b4e151b85d5d2230a1 Mon Sep 17 00:00:00 2001 From: Jeff Palladino Date: Tue, 25 May 2021 09:47:43 -0600 Subject: [PATCH] HACK: update versionstring to parse OS info from PG_VERSION --- .gitignore | 3 +++ postgresql/versionstring.py | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 64db6e5b..706dc220 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ build dist *.pyc + +# JetBrains +.idea \ No newline at end of file diff --git a/postgresql/versionstring.py b/postgresql/versionstring.py index 04c065a5..6c0dbd39 100644 --- a/postgresql/versionstring.py +++ b/postgresql/versionstring.py @@ -8,12 +8,13 @@ (8, 0, 1, None, None) """ + def split(vstr: str) -> tuple: """ Split a PostgreSQL version string into a tuple. (major, minor, patch, ..., state_class, state_level) """ - v = vstr.strip().split('.') + v = vstr.strip().split('(') # Get rid of the numbers around the state_class (beta,a,dev,alpha, etc) state_class = v[-1].strip('0123456789') @@ -23,7 +24,7 @@ def split(vstr: str) -> tuple: state_level = None else: state_level = int(state_level) - vlist = [int(x or '0') for x in v[:-1]] + vlist = [int(float(x) or '0') for x in v[:-1]] if last_version: vlist.append(int(last_version)) vlist += [None] * (3 - len(vlist))