1
0
Fork 0

Fix list_builder.py to be compatible with Python 3.9

This commit is contained in:
Alexandre Aubin 2024-02-09 01:41:33 +01:00
parent f1e7901e52
commit 43f3495257
2 changed files with 5 additions and 5 deletions

View file

@ -2,7 +2,7 @@
import sys import sys
import subprocess import subprocess
from typing import Any, TextIO, Generator from typing import Any, TextIO, Generator, Optional, Union
import time import time
from functools import cache from functools import cache
from pathlib import Path from pathlib import Path
@ -18,7 +18,7 @@ def apps_repo_root() -> Path:
return Path(__file__).parent.parent.parent return Path(__file__).parent.parent.parent
def git(cmd: list[str], cwd: Path | None = None) -> str: def git(cmd: list[str], cwd: Optional[Path] = None) -> str:
full_cmd = ["git"] full_cmd = ["git"]
if cwd: if cwd:
full_cmd.extend(["-C", str(cwd)]) full_cmd.extend(["-C", str(cwd)])
@ -29,7 +29,7 @@ def git(cmd: list[str], cwd: Path | None = None) -> str:
).strip().decode("utf-8") ).strip().decode("utf-8")
def git_repo_age(path: Path) -> bool | int: def git_repo_age(path: Path) -> Union[bool, int]:
for file in [path / ".git" / "FETCH_HEAD", path / ".git" / "HEAD"]: for file in [path / ".git" / "FETCH_HEAD", path / ".git" / "HEAD"]:
if file.exists(): if file.exists():
return int(time.time() - file.stat().st_mtime) return int(time.time() - file.stat().st_mtime)

View file

@ -10,7 +10,7 @@ import time
from collections import OrderedDict from collections import OrderedDict
from functools import cache from functools import cache
from pathlib import Path from pathlib import Path
from typing import Any from typing import Any, Optional
import toml import toml
import tqdm import tqdm
@ -53,7 +53,7 @@ def antifeatures_list():
# Actual list build management # # Actual list build management #
################################ ################################
def __build_app_dict(data) -> tuple[str, dict[str, Any]] | None: def __build_app_dict(data) -> Optional[tuple[str, dict[str, Any]]]:
name, info = data name, info = data
try: try:
return name, build_app_dict(name, info) return name, build_app_dict(name, info)