mirror of
https://github.com/aclist/dztui.git
synced 2026-11-13 05:11:52 +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
|
import tomllib
|
||||||
from shared import get_git_root
|
from shared import get_git_root
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
|
|
||||||
def get_entrypoint() -> None:
|
def get_entrypoint() -> Any:
|
||||||
root = get_git_root()
|
root = get_git_root()
|
||||||
p = root.joinpath("pyproject.toml")
|
p = root.joinpath("pyproject.toml")
|
||||||
with open(p, "rb") as f:
|
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))
|
os.rename(_dir, build_dir.joinpath(renamed))
|
||||||
|
|
||||||
|
|
||||||
def install_deps() -> None:
|
def install_deps() -> int:
|
||||||
pip = build_dir.joinpath(f"{CPYTHON_BUILD}/bin/pip")
|
pip = build_dir.joinpath(f"{CPYTHON_BUILD}/bin/pip")
|
||||||
proc = subprocess.run([pip, "install", root])
|
proc = subprocess.run([pip, "install", root])
|
||||||
return proc.returncode
|
return proc.returncode
|
||||||
@@ -65,12 +65,12 @@ def repackage() -> None:
|
|||||||
tar.add(build_dir.joinpath(CPYTHON_BUILD), arcname="python")
|
tar.add(build_dir.joinpath(CPYTHON_BUILD), arcname="python")
|
||||||
|
|
||||||
|
|
||||||
def rebuild_cpython() -> None:
|
def rebuild_cpython() -> str:
|
||||||
if cpython_dir.is_dir() is False:
|
if cpython_dir.is_dir() is False:
|
||||||
get_cpython()
|
get_cpython()
|
||||||
code = install_deps()
|
code = install_deps()
|
||||||
if code != 0:
|
if code != 0:
|
||||||
return
|
return ""
|
||||||
repackage()
|
repackage()
|
||||||
return get_packaged_version()
|
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)
|
tar.add(subfolder, arcname=appname, filter=update_uname)
|
||||||
print(f"Wrote tarfile to '{tarpath}'")
|
print(f"Wrote tarfile to '{tarpath}'")
|
||||||
|
|
||||||
proc = subprocess.run([release_exe, "-v"], capture_output=True, text=True)
|
built_proc = subprocess.run([release_exe, "-v"], capture_output=True, text=True)
|
||||||
assert proc.stdout.rstrip() == version
|
assert str(built_proc.stdout).rstrip() == version
|
||||||
|
|
||||||
# TODO: clean up staging directory
|
# TODO: clean up staging directory
|
||||||
release_exe.unlink()
|
release_exe.unlink()
|
||||||
|
|||||||
+10
-4
@@ -8,7 +8,13 @@ def get_image_path() -> Path:
|
|||||||
return get_git_root().joinpath("dzgui/data/images/example.png")
|
return get_git_root().joinpath("dzgui/data/images/example.png")
|
||||||
|
|
||||||
|
|
||||||
p = get_image_path()
|
def take_screenshot() -> None:
|
||||||
app = build_gui("", False)
|
p = get_image_path()
|
||||||
app.set_automation_param("screenshot_path", p)
|
app = build_gui("", False)
|
||||||
app.run(None)
|
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
|
import sys
|
||||||
|
|
||||||
cmd = ["git", "ls-files", "--others", "--exclude-standard"]
|
cmd = ["git", "ls-files", "--others", "--exclude-standard"]
|
||||||
result = subprocess.Popen(
|
result = subprocess.run(
|
||||||
cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True
|
cmd, capture_output=True, text=True
|
||||||
)
|
)
|
||||||
with open(".gitignore", "r") as f:
|
untracked = [os.path.basename(line.rstrip()) for line in result.stdout.splitlines()]
|
||||||
ignored = [line.rstrip() for line in f]
|
if bool(untracked):
|
||||||
|
print(f"The following files are untracked. Add to .gitignore if this is intended.")
|
||||||
untracked = [os.path.basename(line.rstrip()) for line in result.stdout]
|
print("\n".join(untracked))
|
||||||
for file in untracked:
|
sys.exit(1)
|
||||||
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)
|
|
||||||
Reference in new issue
Block a user