1#!/usr/bin/env python3 2""" 3PostgreSQL database adapter for Python - Connection Pool 4""" 5 6# Copyright (C) 2020-2021 The Psycopg Team 7 8import os 9import re 10from setuptools import setup 11 12# Move to the directory of setup.py: executing this file from another location 13# (e.g. from the project root) will fail 14here = os.path.abspath(os.path.dirname(__file__)) 15if os.path.abspath(os.getcwd()) != here: 16 os.chdir(here) 17 18with open("psycopg_pool/version.py") as f: 19 data = f.read() 20 m = re.search(r"""(?m)^__version__\s*=\s*['"]([^'"]+)['"]""", data) 21 if not m: 22 raise Exception(f"cannot find version in {f.name}") 23 version = m.group(1) 24 25 26setup(version=version) 27