mirror of
https://github.com/psycopg/psycopg2.git
synced 2024-11-10 19:16:34 +03:00
Fixed PostgreSQL version matching after PG 10
Backport to psycopg 2.6 of ticket #489, ticket #632
This commit is contained in:
parent
b179645ff7
commit
4ae2a36610
2
NEWS
2
NEWS
|
@ -7,6 +7,8 @@ What's new in psycopg 2.6.3
|
||||||
- Throw an exception trying to pass ``NULL`` chars as parameters
|
- Throw an exception trying to pass ``NULL`` chars as parameters
|
||||||
(:ticket:`#420`).
|
(:ticket:`#420`).
|
||||||
- Make `~psycopg2.extras.Range` objects picklable (:ticket:`#462`).
|
- Make `~psycopg2.extras.Range` objects picklable (:ticket:`#462`).
|
||||||
|
- Fixed version parsing and building of PostgreSQL 10.
|
||||||
|
Fix backport for :tickets:`#489, #632`.
|
||||||
|
|
||||||
|
|
||||||
What's new in psycopg 2.6.2
|
What's new in psycopg 2.6.2
|
||||||
|
|
9
setup.py
9
setup.py
|
@ -415,13 +415,18 @@ class psycopg_build_ext(build_ext):
|
||||||
pgversion = "7.4.0"
|
pgversion = "7.4.0"
|
||||||
|
|
||||||
verre = re.compile(
|
verre = re.compile(
|
||||||
r"(\d+)\.(\d+)(?:(?:\.(\d+))|(devel|(alpha|beta|rc)\d+))")
|
r"(\d+)(?:\.(\d+))?(?:(?:\.(\d+))|(devel|(?:alpha|beta|rc)\d+))?")
|
||||||
m = verre.match(pgversion)
|
m = verre.match(pgversion)
|
||||||
if m:
|
if m:
|
||||||
pgmajor, pgminor, pgpatch = m.group(1, 2, 3)
|
pgmajor, pgminor, pgpatch = m.group(1, 2, 3)
|
||||||
|
# Postgres >= 10 doesn't have pgminor anymore.
|
||||||
|
pgmajor = int(pgmajor)
|
||||||
|
if pgmajor >= 10:
|
||||||
|
pgminor, pgpatch = None, pgminor
|
||||||
|
if pgminor is None or not pgminor.isdigit():
|
||||||
|
pgminor = 0
|
||||||
if pgpatch is None or not pgpatch.isdigit():
|
if pgpatch is None or not pgpatch.isdigit():
|
||||||
pgpatch = 0
|
pgpatch = 0
|
||||||
pgmajor = int(pgmajor)
|
|
||||||
pgminor = int(pgminor)
|
pgminor = int(pgminor)
|
||||||
pgpatch = int(pgpatch)
|
pgpatch = int(pgpatch)
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user