File tree 1 file changed +5
-4
lines changed
1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -177,16 +177,17 @@ def get_pg_version(bin_dir=None):
177
177
Return PostgreSQL version provided by postmaster.
178
178
"""
179
179
180
- # get raw version (e.g. postgres (PostgreSQL) 9.5.7)
180
+ # Get raw version (e.g. postgres (PostgreSQL) 9.5.7)
181
181
postgres_path = os .path .join (bin_dir , 'postgres' ) if bin_dir else get_bin_path ('postgres' )
182
182
_params = [postgres_path , '--version' ]
183
183
raw_ver = tconf .os_ops .exec_command (_params , encoding = 'utf-8' )
184
184
185
- # Remove "(Homebrew)" if present
185
+ # Remove "(Homebrew)" and "(Ubuntu <version>)" if present
186
186
raw_ver = raw_ver .replace ('(Homebrew)' , '' ).strip ()
187
+ raw_ver = re .sub (r'\(Ubuntu[^)]*\)' , '' , raw_ver ).strip ()
187
188
188
- # cook version of PostgreSQL
189
- version = raw_ver .strip (). split (' ' )[- 1 ] \
189
+ # Cook version of PostgreSQL
190
+ version = raw_ver .split (' ' )[- 1 ] \
190
191
.partition ('devel' )[0 ] \
191
192
.partition ('beta' )[0 ] \
192
193
.partition ('rc' )[0 ]
You can’t perform that action at this time.
0 commit comments