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

Commit

Permalink
feat: add back Python 3.7 support
Browse files Browse the repository at this point in the history
We do not test the code against Python 3.7 runtime so the support might
break in the future release.

Fix #292
  • Loading branch information
seanwu1105 committed Sep 20, 2023
1 parent 7867e39 commit e44eba4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
12 changes: 8 additions & 4 deletions python/scripts/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@

QT_DEPENDENCY_ARG = "vscode_extension_qt_dependency"

SupportedQtDependencies = typing.Optional[
typing.Literal["PySide6", "PySide2", "PyQt6", "PyQt5"]
]
if sys.version_info < (3, 8):
SupportedQtDependencies = typing.Optional[str] # pragma: no cover
else:
SupportedQtDependencies = typing.Optional[
typing.Literal["PySide6", "PySide2", "PyQt6", "PyQt5"]
]


def is_installed(name: str) -> bool:
Expand All @@ -21,7 +24,8 @@ def parse_qt_dependency() -> SupportedQtDependencies:
required=False,
)

if dep := vars(parser.parse_known_args()[0])[QT_DEPENDENCY_ARG]:
dep = vars(parser.parse_known_args()[0])[QT_DEPENDENCY_ARG]
if dep is not None:
sys.argv.remove(f"--{QT_DEPENDENCY_ARG}")
sys.argv.remove(dep)

Expand Down
10 changes: 7 additions & 3 deletions python/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os
import platform
import subprocess
import sys
import typing

from scripts.utils import QT_DEPENDENCY_ARG, SupportedQtDependencies
Expand All @@ -11,9 +12,12 @@

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

SupportedScripts = typing.Literal[
"designer", "qml", "qmlls", "rcc", "uic", "lupdate", "linguist", "lrelease"
]
if sys.version_info < (3, 8):
SupportedScripts = str
else:
SupportedScripts = typing.Literal[
"designer", "qml", "qmlls", "rcc", "uic", "lupdate", "linguist", "lrelease"
]


def filter_available_qt_dependencies(
Expand Down

0 comments on commit e44eba4

Please sign in to comment.