mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2025-07-21 10:15:12 +03:00
60 lines
1.7 KiB
Diff
60 lines
1.7 KiB
Diff
Patch-Source: https://github.com/lincolnloop/python-qrcode/pull/309
|
|
From e117dd08fa4e6e4cef422b4222543194f5df07e8 Mon Sep 17 00:00:00 2001
|
|
From: ptrcnull <git@ptrcnull.me>
|
|
Date: Thu, 9 Feb 2023 00:13:00 +0100
|
|
Subject: [PATCH] Use typing_extensions only when needed
|
|
|
|
Literal has been added with PEP 586 to Python 3.8
|
|
---
|
|
qrcode/image/svg.py | 6 +++++-
|
|
qrcode/main.py | 6 +++++-
|
|
setup.cfg | 2 +-
|
|
3 files changed, 11 insertions(+), 3 deletions(-)
|
|
|
|
diff --git a/qrcode/image/svg.py b/qrcode/image/svg.py
|
|
index bf0ec87..c081008 100644
|
|
--- a/qrcode/image/svg.py
|
|
+++ b/qrcode/image/svg.py
|
|
@@ -2,7 +2,11 @@ import decimal
|
|
from decimal import Decimal
|
|
from typing import List, Optional, Type, Union, overload
|
|
|
|
-from typing_extensions import Literal
|
|
+try:
|
|
+ # Python 3.8+
|
|
+ from typing import Literal
|
|
+except ImportError:
|
|
+ from typing_extensions import Literal
|
|
|
|
import qrcode.image.base
|
|
from qrcode.compat.etree import ET
|
|
diff --git a/qrcode/main.py b/qrcode/main.py
|
|
index 0ac91bb..177c22f 100644
|
|
--- a/qrcode/main.py
|
|
+++ b/qrcode/main.py
|
|
@@ -12,7 +12,11 @@ from typing import (
|
|
overload,
|
|
)
|
|
|
|
-from typing_extensions import Literal
|
|
+try:
|
|
+ # Python 3.8+
|
|
+ from typing import Literal
|
|
+except ImportError:
|
|
+ from typing_extensions import Literal
|
|
|
|
from qrcode import constants, exceptions, util
|
|
from qrcode.image.base import BaseImage
|
|
diff --git a/setup.cfg b/setup.cfg
|
|
index 6df43f2..dbcee03 100644
|
|
--- a/setup.cfg
|
|
+++ b/setup.cfg
|
|
@@ -29,7 +29,7 @@ include_package_data = True
|
|
packages = find:
|
|
install_requires =
|
|
colorama;platform_system=="Windows"
|
|
- typing_extensions
|
|
+ typing_extensions;python_version<"3.8.0"
|
|
pypng
|
|
python_requires = >= 3.7
|
|
|