Changeset 874 for branches/4.x


Ignore:
Timestamp:
Apr 16, 2016, 3:05:28 AM (3 years ago)
Author:
cito
Message:

Let setup understand Postgres beta versions

Postgres versions such as "PostgreSQL 9.5beta1" were not handled properly,
because the "5beta1" part of the version was not converted to an int.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/4.x/setup.py

    r860 r874  
    4545import os
    4646import platform
     47import re
    4748import warnings
    4849try:
     
    7879def pg_version():
    7980    """Return the PostgreSQL version as a tuple of integers."""
    80     parts = []
    81     for part in pg_config('version').split()[-1].split('.'):
    82         if part.isdigit():
    83             part = int(part)
    84         parts.append(part)
    85     return tuple(parts or [8, 3])
     81    match = re.search(r'(\d+)\.(\d+)', pg_config('version'))
     82    if match:
     83        return tuple(map(int, match.groups()))
     84    return (8, 3)
    8685
    8786
Note: See TracChangeset for help on using the changeset viewer.