1
0
Fork 0
mirror of https://gitlab.alpinelinux.org/alpine/aports.git synced 2025-07-15 20:25:17 +03:00
aports/testing/py3-janus/no-typing-extensions.patch
2023-02-13 06:25:36 +00:00

42 lines
1.2 KiB
Diff

Patch-Source: https://github.com/aio-libs/janus/pull/504
From 78632be4f75181432dc2ccffe912e063a8258a65 Mon Sep 17 00:00:00 2001
From: ptrcnull <git@ptrcnull.me>
Date: Sun, 12 Feb 2023 22:33:15 +0100
Subject: [PATCH] Use typing_extensions only on Python 3.7 and lower
Protocol was added with PEP 544 to Python 3.8+
---
janus/__init__.py | 6 +++++-
setup.cfg | 2 +-
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/janus/__init__.py b/janus/__init__.py
index a2887aa..8b2a9fe 100644
--- a/janus/__init__.py
+++ b/janus/__init__.py
@@ -9,7 +9,11 @@ from queue import Empty as SyncQueueEmpty
from queue import Full as SyncQueueFull
from typing import Any, Callable, Deque, Generic, List, Optional, Set, TypeVar
-from typing_extensions import Protocol
+try:
+ # Python 3.8+
+ from typing import Protocol
+except ImportError:
+ from typing_extensions import Protocol
__version__ = "1.0.0"
__all__ = (
diff --git a/setup.cfg b/setup.cfg
index e0032f3..44a6efe 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -44,7 +44,7 @@ packages = find:
zip_safe = True
include_package_data = True
install_requires =
- typing-extensions>=3.7.4.3
+ typing-extensions>=3.7.4.3;python_version<"3.8"
[flake8]
exclude = .git,.env,__pycache__,.eggs