mirror of
https://github.com/aclist/dztui.git
synced 2026-11-12 04:50:37 +01:00
chore: clear typehinting errors in build scripts
This commit is contained in:
1 parent
77682cacd4
commit
d2208787b4
5 files changed
+24
-20
No files matched your search
@@ -1,8 +1,9 @@
|
||||
import tomllib
|
||||
from shared import get_git_root
|
||||
from typing import Any
|
||||
|
||||
|
||||
def get_entrypoint() -> None:
|
||||
def get_entrypoint() -> Any:
|
||||
root = get_git_root()
|
||||
p = root.joinpath("pyproject.toml")
|
||||
with open(p, "rb") as f:
|
||||
|
||||
+3
-3
@@ -52,7 +52,7 @@ def untar(file: str, glob: str, renamed: str) -> None:
|
||||
os.rename(_dir, build_dir.joinpath(renamed))
|
||||
|
||||
|
||||
def install_deps() -> None:
|
||||
def install_deps() -> int:
|
||||
pip = build_dir.joinpath(f"{CPYTHON_BUILD}/bin/pip")
|
||||
proc = subprocess.run([pip, "install", root])
|
||||
return proc.returncode
|
||||
@@ -65,12 +65,12 @@ def repackage() -> None:
|
||||
tar.add(build_dir.joinpath(CPYTHON_BUILD), arcname="python")
|
||||
|
||||
|
||||
def rebuild_cpython() -> None:
|
||||
def rebuild_cpython() -> str:
|
||||
if cpython_dir.is_dir() is False:
|
||||
get_cpython()
|
||||
code = install_deps()
|
||||
if code != 0:
|
||||
return
|
||||
return ""
|
||||
repackage()
|
||||
return get_packaged_version()
|
||||
|
||||
|
||||
+2
-2
@@ -92,8 +92,8 @@ with tarfile.open(tarpath, "w:gz") as tar:
|
||||
tar.add(subfolder, arcname=appname, filter=update_uname)
|
||||
print(f"Wrote tarfile to '{tarpath}'")
|
||||
|
||||
proc = subprocess.run([release_exe, "-v"], capture_output=True, text=True)
|
||||
assert proc.stdout.rstrip() == version
|
||||
built_proc = subprocess.run([release_exe, "-v"], capture_output=True, text=True)
|
||||
assert str(built_proc.stdout).rstrip() == version
|
||||
|
||||
# TODO: clean up staging directory
|
||||
release_exe.unlink()
|
||||
|
||||
+10
-4
@@ -8,7 +8,13 @@ def get_image_path() -> Path:
|
||||
return get_git_root().joinpath("dzgui/data/images/example.png")
|
||||
|
||||
|
||||
p = get_image_path()
|
||||
app = build_gui("", False)
|
||||
app.set_automation_param("screenshot_path", p)
|
||||
app.run(None)
|
||||
def take_screenshot() -> None:
|
||||
p = get_image_path()
|
||||
app = build_gui("", False)
|
||||
if app is None:
|
||||
return
|
||||
app.set_automation_param("screenshot_path", p)
|
||||
app.run(None)
|
||||
|
||||
|
||||
take_screenshot()
|
||||
+7
-10
@@ -3,14 +3,11 @@ import subprocess
|
||||
import sys
|
||||
|
||||
cmd = ["git", "ls-files", "--others", "--exclude-standard"]
|
||||
result = subprocess.Popen(
|
||||
cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True
|
||||
result = subprocess.run(
|
||||
cmd, capture_output=True, text=True
|
||||
)
|
||||
with open(".gitignore", "r") as f:
|
||||
ignored = [line.rstrip() for line in f]
|
||||
|
||||
untracked = [os.path.basename(line.rstrip()) for line in result.stdout]
|
||||
for file in untracked:
|
||||
if not any(file in item for item in ignored):
|
||||
print(f"File '{file}' is untracked. Add to .gitignore file if this is intended.")
|
||||
sys.exit(1)
|
||||
untracked = [os.path.basename(line.rstrip()) for line in result.stdout.splitlines()]
|
||||
if bool(untracked):
|
||||
print(f"The following files are untracked. Add to .gitignore if this is intended.")
|
||||
print("\n".join(untracked))
|
||||
sys.exit(1)
|
||||
Reference in new issue
Block a user