1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-28 07:03:00 +08:00

chore(scripts): allow to run update_version.py with python3.8 (#6788)

Signed-off-by: Neo Xu <neo.xu1990@gmail.com>
This commit is contained in:
Neo Xu 2024-09-09 23:51:24 +08:00 committed by GitHub
parent 2cd6cc1efc
commit a7855bc531
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -3,6 +3,7 @@
import os
import re
import argparse
from typing import List, Union
def get_arg():
@ -43,12 +44,12 @@ class RepoFileVersionReplacer:
DIR_SCRIPTS = os.path.dirname(__file__)
DIR_REPO_ROOT = os.path.join(DIR_SCRIPTS, "..")
def __init__(self, relative_path_segments: list[str], expected_occurrences: int):
def __init__(self, relative_path_segments: List[str], expected_occurrences: int):
self.path_relative = os.path.join(*relative_path_segments)
self.path = os.path.join(self.DIR_REPO_ROOT, self.path_relative)
self.expected_occurrences = expected_occurrences
def applyVersionToLine(self, line: str, version: Version) -> str | None:
def applyVersionToLine(self, line: str, version: Version) -> Union[str, None]:
return None
def applyVersion(self, version: Version):
@ -72,7 +73,7 @@ class RepoFileVersionReplacer:
class PrefixReplacer(RepoFileVersionReplacer):
def __init__(self, relative_path_segments: list[str], prefix: str, expected_occurrences=1):
def __init__(self, relative_path_segments: List[str], prefix: str, expected_occurrences=1):
super().__init__(relative_path_segments, expected_occurrences)
self.prefix = prefix
@ -84,7 +85,7 @@ class PrefixReplacer(RepoFileVersionReplacer):
class MacroReplacer(RepoFileVersionReplacer):
def __init__(self, relative_path_segments: list[str]):
def __init__(self, relative_path_segments: List[str]):
super().__init__(relative_path_segments, 4)
def applyVersionToLine(self, line: str, version: Version):