From 1fe8eee6a7517b736db44358ad17da2463fb496b Mon Sep 17 00:00:00 2001 From: Antoine Martin Date: Wed, 30 Aug 2023 14:12:30 -0400 Subject: [PATCH] backports/py3-psycopg: new aport --- backports/py3-psycopg/APKBUILD | 43 ++++++ backports/py3-psycopg/typing-ext.patch | 201 +++++++++++++++++++++++++ 2 files changed, 244 insertions(+) create mode 100644 backports/py3-psycopg/APKBUILD create mode 100644 backports/py3-psycopg/typing-ext.patch diff --git a/backports/py3-psycopg/APKBUILD b/backports/py3-psycopg/APKBUILD new file mode 100644 index 0000000..08ebe84 --- /dev/null +++ b/backports/py3-psycopg/APKBUILD @@ -0,0 +1,43 @@ +# Contributor: omni +# Maintainer: omni +pkgname=py3-psycopg +pkgver=3.1.10 +pkgrel=0 +pkgdesc="PostgreSQL adapter for python" +options="!check" # Requires running database +url="https://www.psycopg.org/" +arch="all" +license="LGPL-2.0-or-later" +# TODO: Remove py3-typing-extensions after upgrading python3 to 3.11 +makedepends=" + libpq-dev + py3-gpep517 + py3-setuptools + py3-wheel + python3-dev + " +subpackages="$pkgname-pyc" +source="https://files.pythonhosted.org/packages/source/p/psycopg/psycopg-$pkgver.tar.gz + typing-ext.patch + " +builddir="$srcdir/psycopg-$pkgver" + +build() { + gpep517 build-wheel \ + --wheel-dir .dist \ + --output-fd 3 3>&1 >&2 +} + +check() { + make check +} + +package() { + python3 -m installer -d "$pkgdir" \ + .dist/*.whl +} + +sha512sums=" +9aad13a487e8b7e945a044d0b19e0e2cf14e87d3ffc6a03dd3fbf608886b056708fb700678f3d415ab1c19a8cb48a7a685729d0a3d43992beaae00f640b94669 psycopg-3.1.10.tar.gz +eea6e80ae5c15398425fbebd662eca480daa69cab217b1b15db096e5cf830192d4a9b2f1f6cbaf2e85871a5994beec7db41778242df9ef3766164165b253c9c1 typing-ext.patch +" diff --git a/backports/py3-psycopg/typing-ext.patch b/backports/py3-psycopg/typing-ext.patch new file mode 100644 index 0000000..fea257d --- /dev/null +++ b/backports/py3-psycopg/typing-ext.patch @@ -0,0 +1,201 @@ +diff --git a/psycopg/_compat.py b/psycopg/_compat.py +index 7dbae79..b3f2a1c 100644 +--- a/psycopg/_compat.py ++++ b/psycopg/_compat.py +@@ -11,12 +11,11 @@ from typing import Any, Awaitable, Generator, Optional, Sequence, Union, TypeVar + # NOTE: TypeAlias cannot be exported by this module, as pyright special-cases it. + # For this raisin it must be imported directly from typing_extension where used. + # See https://github.com/microsoft/pyright/issues/4197 +-from typing_extensions import TypeAlias + + if sys.version_info >= (3, 8): +- from typing import Protocol ++ from typing import Protocol, TypeAlias + else: +- from typing_extensions import Protocol ++ from typing import Protocol + + T = TypeVar("T") + FutureT: TypeAlias = Union["asyncio.Future[T]", Generator[Any, None, T], Awaitable[T]] +@@ -52,12 +51,12 @@ else: + if sys.version_info >= (3, 10): + from typing import TypeGuard + else: +- from typing_extensions import TypeGuard ++ from typing import TypeGuard + + if sys.version_info >= (3, 11): + from typing import LiteralString + else: +- from typing_extensions import LiteralString ++ from typing import LiteralString + + __all__ = [ + "Counter", +diff --git a/psycopg/_pipeline.py b/psycopg/_pipeline.py +index c818d86..ef9358e 100644 +--- a/psycopg/_pipeline.py ++++ b/psycopg/_pipeline.py +@@ -7,7 +7,7 @@ commands pipeline management + import logging + from types import TracebackType + from typing import Any, List, Optional, Union, Tuple, Type, TypeVar, TYPE_CHECKING +-from typing_extensions import TypeAlias ++from typing import TypeAlias + + from . import pq + from . import errors as e +diff --git a/psycopg/_preparing.py b/psycopg/_preparing.py +index f60c0cb..cdf403f 100644 +--- a/psycopg/_preparing.py ++++ b/psycopg/_preparing.py +@@ -7,7 +7,7 @@ Support for prepared statements + from enum import IntEnum, auto + from typing import Iterator, Optional, Sequence, Tuple, TYPE_CHECKING + from collections import OrderedDict +-from typing_extensions import TypeAlias ++from typing import TypeAlias + + from . import pq + from ._compat import Deque +diff --git a/psycopg/_struct.py b/psycopg/_struct.py +index 28a6084..a57ddf6 100644 +--- a/psycopg/_struct.py ++++ b/psycopg/_struct.py +@@ -6,7 +6,7 @@ Utility functions to deal with binary structs. + + import struct + from typing import Callable, cast, Optional, Tuple +-from typing_extensions import TypeAlias ++from typing import TypeAlias + + from .abc import Buffer + from . import errors as e +diff --git a/psycopg/_transform.py b/psycopg/_transform.py +index 19bd6ae..a4e3baf 100644 +--- a/psycopg/_transform.py ++++ b/psycopg/_transform.py +@@ -7,7 +7,7 @@ Helper object to transform values between Python and PostgreSQL + from typing import Any, Dict, List, Optional, Sequence, Tuple + from typing import DefaultDict, TYPE_CHECKING + from collections import defaultdict +-from typing_extensions import TypeAlias ++from typing import TypeAlias + + from . import pq + from . import postgres +diff --git a/psycopg/_typeinfo.py b/psycopg/_typeinfo.py +index 52d5ca7..30cba21 100644 +--- a/psycopg/_typeinfo.py ++++ b/psycopg/_typeinfo.py +@@ -9,7 +9,7 @@ information to the adapters if needed. + from enum import Enum + from typing import Any, Dict, Iterator, Optional, overload + from typing import Sequence, Tuple, Type, TypeVar, Union, TYPE_CHECKING +-from typing_extensions import TypeAlias ++from typing import TypeAlias + + from . import errors as e + from .abc import AdaptContext, Query +diff --git a/psycopg/abc.py b/psycopg/abc.py +index 80c8fbf..6d84bf9 100644 +--- a/psycopg/abc.py ++++ b/psycopg/abc.py +@@ -7,7 +7,7 @@ Protocol objects representing different implementations of the same classes. + from typing import Any, Callable, Generator, Mapping + from typing import List, Optional, Sequence, Tuple, TypeVar, Union + from typing import TYPE_CHECKING +-from typing_extensions import TypeAlias ++from typing import TypeAlias + + from . import pq + from ._enums import PyFormat as PyFormat +diff --git a/psycopg/connection.py b/psycopg/connection.py +index 78ad577..a620da3 100644 +--- a/psycopg/connection.py ++++ b/psycopg/connection.py +@@ -14,7 +14,7 @@ from weakref import ref, ReferenceType + from warnings import warn + from functools import partial + from contextlib import contextmanager +-from typing_extensions import TypeAlias ++from typing import TypeAlias + + from . import pq + from . import errors as e +--- a/psycopg/errors.py ++++ b/psycopg/errors.py +@@ -21,7 +21,7 @@ DBAPI-defined Exceptions are defined in + from dataclasses import dataclass, field, fields + from typing import Any, Callable, Dict, List, NoReturn, Optional, Sequence, Tuple, Type + from typing import Union, TYPE_CHECKING +-from typing_extensions import TypeAlias ++from typing import TypeAlias + from asyncio import CancelledError + + from .pq.abc import PGconn, PGresult +diff --git a/psycopg/pq/abc.py b/psycopg/pq/abc.py +index 9c45f64..c28c57c 100644 +--- a/psycopg/pq/abc.py ++++ b/psycopg/pq/abc.py +@@ -6,7 +6,7 @@ Protocol objects to represent objects exposed by different pq implementations. + + from typing import Any, Callable, List, Optional, Sequence, Tuple + from typing import Union, TYPE_CHECKING +-from typing_extensions import TypeAlias ++from typing import TypeAlias + + from ._enums import Format, Trace + from .._compat import Protocol +diff --git a/psycopg/rows.py b/psycopg/rows.py +index cb28b57..68fd23b 100644 +--- a/psycopg/rows.py ++++ b/psycopg/rows.py +@@ -8,7 +8,7 @@ import functools + from typing import Any, Callable, Dict, List, Optional, NamedTuple, NoReturn + from typing import TYPE_CHECKING, Sequence, Tuple, Type, TypeVar + from collections import namedtuple +-from typing_extensions import TypeAlias ++from typing import TypeAlias + + from . import pq + from . import errors as e +diff --git a/psycopg/types/enum.py b/psycopg/types/enum.py +index d3c7387..e602b0e 100644 +--- a/psycopg/types/enum.py ++++ b/psycopg/types/enum.py +@@ -4,7 +4,7 @@ Adapters for the enum type. + from enum import Enum + from typing import Any, Dict, Generic, Optional, Mapping, Sequence + from typing import Tuple, Type, TypeVar, Union, cast +-from typing_extensions import TypeAlias ++from typing import TypeAlias + + from .. import postgres + from .. import errors as e +diff --git a/psycopg/types/hstore.py b/psycopg/types/hstore.py +index e1ab1d5..eaa8dfc 100644 +--- a/psycopg/types/hstore.py ++++ b/psycopg/types/hstore.py +@@ -6,7 +6,7 @@ Dict to hstore adaptation + + import re + from typing import Dict, List, Optional +-from typing_extensions import TypeAlias ++from typing import TypeAlias + + from .. import errors as e + from .. import postgres +diff --git a/psycopg/types/net.py b/psycopg/types/net.py +index 2f2c05b..fc8271b 100644 +--- a/psycopg/types/net.py ++++ b/psycopg/types/net.py +@@ -5,7 +5,7 @@ Adapters for network types. + # Copyright (C) 2020 The Psycopg Team + + from typing import Callable, Optional, Type, Union, TYPE_CHECKING +-from typing_extensions import TypeAlias ++from typing import TypeAlias + + from .. import postgres + from ..pq import Format