File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 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):
177177 Return PostgreSQL version provided by postmaster.
178178 """
179179
180- # get raw version (e.g. postgres (PostgreSQL) 9.5.7)
180+ # Get raw version (e.g. postgres (PostgreSQL) 9.5.7)
181181 postgres_path = os .path .join (bin_dir , 'postgres' ) if bin_dir else get_bin_path ('postgres' )
182182 _params = [postgres_path , '--version' ]
183183 raw_ver = tconf .os_ops .exec_command (_params , encoding = 'utf-8' )
184184
185- # Remove "(Homebrew)" if present
185+ # Remove "(Homebrew)" and "(Ubuntu <version>)" if present
186186 raw_ver = raw_ver .replace ('(Homebrew)' , '' ).strip ()
187+ raw_ver = re .sub (r'\(Ubuntu[^)]*\)' , '' , raw_ver ).strip ()
187188
188- # cook version of PostgreSQL
189- version = raw_ver .strip (). split (' ' )[- 1 ] \
189+ # Cook version of PostgreSQL
190+ version = raw_ver .split (' ' )[- 1 ] \
190191 .partition ('devel' )[0 ] \
191192 .partition ('beta' )[0 ] \
192193 .partition ('rc' )[0 ]
You can’t perform that action at this time.
0 commit comments