Skip to content
This repository was archived by the owner on Oct 15, 2024. It is now read-only.

Commit e44eba4

Browse files
committed
feat: add back Python 3.7 support
We do not test the code against Python 3.7 runtime so the support might break in the future release. Fix #292
1 parent 7867e39 commit e44eba4

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

python/scripts/utils/__init__.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,12 @@
55

66
QT_DEPENDENCY_ARG = "vscode_extension_qt_dependency"
77

8-
SupportedQtDependencies = typing.Optional[
9-
typing.Literal["PySide6", "PySide2", "PyQt6", "PyQt5"]
10-
]
8+
if sys.version_info < (3, 8):
9+
SupportedQtDependencies = typing.Optional[str] # pragma: no cover
10+
else:
11+
SupportedQtDependencies = typing.Optional[
12+
typing.Literal["PySide6", "PySide2", "PyQt6", "PyQt5"]
13+
]
1114

1215

1316
def is_installed(name: str) -> bool:
@@ -21,7 +24,8 @@ def parse_qt_dependency() -> SupportedQtDependencies:
2124
required=False,
2225
)
2326

24-
if dep := vars(parser.parse_known_args()[0])[QT_DEPENDENCY_ARG]:
27+
dep = vars(parser.parse_known_args()[0])[QT_DEPENDENCY_ARG]
28+
if dep is not None:
2529
sys.argv.remove(f"--{QT_DEPENDENCY_ARG}")
2630
sys.argv.remove(dep)
2731

python/tests/__init__.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import os
22
import platform
33
import subprocess
4+
import sys
45
import typing
56

67
from scripts.utils import QT_DEPENDENCY_ARG, SupportedQtDependencies
@@ -11,9 +12,12 @@
1112

1213
ASSETS_DIR = os.path.join(TESTS_DIR, "assets")
1314

14-
SupportedScripts = typing.Literal[
15-
"designer", "qml", "qmlls", "rcc", "uic", "lupdate", "linguist", "lrelease"
16-
]
15+
if sys.version_info < (3, 8):
16+
SupportedScripts = str
17+
else:
18+
SupportedScripts = typing.Literal[
19+
"designer", "qml", "qmlls", "rcc", "uic", "lupdate", "linguist", "lrelease"
20+
]
1721

1822

1923
def filter_available_qt_dependencies(

0 commit comments

Comments
 (0)