mirror of
https://github.com/lvgl/lvgl.git
synced 2025-02-04 07:13: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:
parent
2cd6cc1efc
commit
a7855bc531
@ -3,6 +3,7 @@
|
|||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import argparse
|
import argparse
|
||||||
|
from typing import List, Union
|
||||||
|
|
||||||
|
|
||||||
def get_arg():
|
def get_arg():
|
||||||
@ -43,12 +44,12 @@ class RepoFileVersionReplacer:
|
|||||||
DIR_SCRIPTS = os.path.dirname(__file__)
|
DIR_SCRIPTS = os.path.dirname(__file__)
|
||||||
DIR_REPO_ROOT = os.path.join(DIR_SCRIPTS, "..")
|
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_relative = os.path.join(*relative_path_segments)
|
||||||
self.path = os.path.join(self.DIR_REPO_ROOT, self.path_relative)
|
self.path = os.path.join(self.DIR_REPO_ROOT, self.path_relative)
|
||||||
self.expected_occurrences = expected_occurrences
|
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
|
return None
|
||||||
|
|
||||||
def applyVersion(self, version: Version):
|
def applyVersion(self, version: Version):
|
||||||
@ -72,7 +73,7 @@ class RepoFileVersionReplacer:
|
|||||||
|
|
||||||
class PrefixReplacer(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)
|
super().__init__(relative_path_segments, expected_occurrences)
|
||||||
self.prefix = prefix
|
self.prefix = prefix
|
||||||
|
|
||||||
@ -84,7 +85,7 @@ class PrefixReplacer(RepoFileVersionReplacer):
|
|||||||
|
|
||||||
|
|
||||||
class MacroReplacer(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)
|
super().__init__(relative_path_segments, 4)
|
||||||
|
|
||||||
def applyVersionToLine(self, line: str, version: Version):
|
def applyVersionToLine(self, line: str, version: Version):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user