mirror of
https://github.com/aclist/dztui.git
synced 2026-08-30 03:37:00 +02:00
Compare commits
15 Commits
58a2bf0bfa
...
549d441179
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
549d441179 | ||
|
|
52f3ec4570 | ||
|
|
14752440d1 | ||
|
|
b05c353914 | ||
|
|
b21b7c5a5d | ||
|
|
1b626130d5 | ||
|
|
c080847efc | ||
|
|
40e244e05a | ||
|
|
a1ef96094f | ||
|
|
8edb38f175 | ||
|
|
485d0721da | ||
|
|
5b90068fe4 | ||
|
|
63a853af7c | ||
|
|
41b0e86fda | ||
|
|
fa486c2b76 |
@ -1,23 +1,30 @@
|
|||||||
# TODO: link to here from sphinx docs
|
# TODO: link to here from sphinx docs
|
||||||
|
|
||||||
# Installing dev dependencies
|
## Installing from source
|
||||||
uv pip install -e .[dev]
|
|
||||||
|
|
||||||
# Setting up precommit hooks
|
### Fetch submodules
|
||||||
pre-commit install
|
|
||||||
|
|
||||||
# Fetching submodules
|
|
||||||
git submodule update --recursive --init
|
git submodule update --recursive --init
|
||||||
|
|
||||||
# Building documentation
|
### Install with dev dependencies
|
||||||
|
uv pip install -e '.[dev]'
|
||||||
|
|
||||||
|
This includes all dependencies for building, linting, testing, and checking in code.
|
||||||
|
If you optionally want to install only a subset of dev tools, replace 'dev' with the following flag:
|
||||||
|
|
||||||
|
build: package release deps
|
||||||
|
docs: documentation tools
|
||||||
|
lint: code linting, fixing, and type checking
|
||||||
|
test: unit and integration tests
|
||||||
|
|
||||||
|
## Miscellaneous
|
||||||
|
|
||||||
|
### Setting up precommit hooks
|
||||||
|
pre-commit install
|
||||||
|
|
||||||
|
### Building documentation
|
||||||
sphinx-build -M html source build -a
|
sphinx-build -M html source build -a
|
||||||
|
|
||||||
# Building standalone DZGUI release binaries
|
### Building standalone release binaries
|
||||||
1. Run `./scripts/dl_pyapp.sh`
|
1. Set up the build target: `rustup target add x86_64-unknown-linux-musl`
|
||||||
# TODO: secondary script that packs this archive
|
2. Run `python3 scripts/release.py`
|
||||||
2. Download cpython 3.13, linux, gnu, v3
|
3. Generate a release and tag against the resulting tarfile generated in `dist`
|
||||||
https://github.com/astral-sh/python-build-standalone/releases/download/20251014/cpython-3.13.9%2B20251014-x86_64_v3-unknown-linux-gnu-install_only_stripped.tar.gz
|
|
||||||
3. Explicitly install dependencies into site-packages
|
|
||||||
4. Pack back into a tarball
|
|
||||||
5. Run `python3 scripts/release.py`
|
|
||||||
6. Generate a release and tag against the bundled `dzgui` executable
|
|
||||||
|
|||||||
51
dzgui/init/libgi.py
Normal file
51
dzgui/init/libgi.py
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
import platform
|
||||||
|
import sys
|
||||||
|
|
||||||
|
from pathlib import Path
|
||||||
|
from warnings import deprecated
|
||||||
|
|
||||||
|
LIB = "libgirepository-2.0"
|
||||||
|
|
||||||
|
@deprecated("currently unused")
|
||||||
|
def is_debian() -> bool:
|
||||||
|
"""
|
||||||
|
cf.
|
||||||
|
|
||||||
|
NAME="Debian GNU/Linux"
|
||||||
|
ID=debian
|
||||||
|
|
||||||
|
NAME="Ubuntu"
|
||||||
|
ID=ubuntu
|
||||||
|
ID_LIKE=debian
|
||||||
|
|
||||||
|
NAME="Linux Mint"
|
||||||
|
ID=linuxmint
|
||||||
|
ID_LIKE="ubuntu debian"
|
||||||
|
|
||||||
|
NAME="Pop!_OS"
|
||||||
|
ID=pop
|
||||||
|
ID_LIKE="ubuntu debian"
|
||||||
|
"""
|
||||||
|
release = platform.freedesktop_os_release()
|
||||||
|
strings = ["ubuntu debian", "debian"]
|
||||||
|
try:
|
||||||
|
self_id = release["ID"]
|
||||||
|
if self_id == "debian":
|
||||||
|
return True
|
||||||
|
id_like = release["ID_LIKE"]
|
||||||
|
return id_like in strings
|
||||||
|
except Exception:
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
def has_libgi() -> bool:
|
||||||
|
parent_dir = Path("/usr/lib64")
|
||||||
|
exists = any(LIB in subdir.name for subdir in parent_dir.iterdir())
|
||||||
|
return exists
|
||||||
|
|
||||||
|
|
||||||
|
def test_missing_lib() -> bool:
|
||||||
|
msg = f"System is missing the required library '{LIB}'. Install it via your system package manager."
|
||||||
|
if has_libgi() is False:
|
||||||
|
print(msg)
|
||||||
|
sys.exit(1)
|
||||||
@ -1,6 +1,7 @@
|
|||||||
import build
|
import build
|
||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import sys
|
||||||
import tarfile
|
import tarfile
|
||||||
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
@ -9,19 +10,20 @@ from concat_licenses import concat_license
|
|||||||
from parse_toml import get_entrypoint
|
from parse_toml import get_entrypoint
|
||||||
from prebuild import get_pyapp, rebuild_cpython
|
from prebuild import get_pyapp, rebuild_cpython
|
||||||
|
|
||||||
|
|
||||||
def update_uname(info: tarfile.TarInfo) -> tarfile.TarInfo:
|
def update_uname(info: tarfile.TarInfo) -> tarfile.TarInfo:
|
||||||
info.uname = "dzgui"
|
info.uname = "dzgui"
|
||||||
info.gname = "users"
|
info.gname = "users"
|
||||||
return info
|
return info
|
||||||
|
|
||||||
|
|
||||||
root = Path(__file__).resolve().parents[1]
|
root = Path(__file__).resolve().parents[1]
|
||||||
output = root.joinpath("dist")
|
dist_dir = root.joinpath("dist")
|
||||||
build_dir = root.joinpath("build")
|
build_dir = root.joinpath("build")
|
||||||
|
|
||||||
builder = build.ProjectBuilder(root)
|
builder = build.ProjectBuilder(root)
|
||||||
wheel = builder.build("wheel", output_directory=output)
|
wheel = builder.build("wheel", output_directory=dist_dir)
|
||||||
stem = Path(wheel).stem
|
stem = Path(wheel).stem
|
||||||
tarname = f"{stem}.tar.gz"
|
|
||||||
|
|
||||||
metadata = stem.split("-")
|
metadata = stem.split("-")
|
||||||
appname = metadata[0]
|
appname = metadata[0]
|
||||||
@ -51,24 +53,42 @@ env["PYAPP_FULL_ISOLATION"] = "true"
|
|||||||
env["PYAPP_DISTRIBUTION_PATH"] = str(cpython)
|
env["PYAPP_DISTRIBUTION_PATH"] = str(cpython)
|
||||||
env["PYAPP_DISTRIBUTION_PYTHON_PATH"] = "python/bin/python3"
|
env["PYAPP_DISTRIBUTION_PYTHON_PATH"] = "python/bin/python3"
|
||||||
|
|
||||||
subfolder = output.joinpath(stem)
|
platform = "x86_64-unknown-linux-musl"
|
||||||
|
build_name = f"{appname}-{version}-{platform}"
|
||||||
|
tarname = f"{build_name}.tar.gz"
|
||||||
|
tarpath = dist_dir.joinpath(tarname)
|
||||||
|
|
||||||
|
build_params = [
|
||||||
|
"cargo",
|
||||||
|
"build",
|
||||||
|
"--release",
|
||||||
|
"--target",
|
||||||
|
platform,
|
||||||
|
]
|
||||||
|
|
||||||
|
proc = subprocess.run(
|
||||||
|
build_params,
|
||||||
|
env=env,
|
||||||
|
cwd=pyapp_dir,
|
||||||
|
)
|
||||||
|
|
||||||
|
if proc.returncode != 0:
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
subfolder = dist_dir.joinpath(build_name)
|
||||||
subfolder.mkdir(parents=True)
|
subfolder.mkdir(parents=True)
|
||||||
|
|
||||||
|
output_exe = pyapp_dir.joinpath(f"target/{platform}/release/pyapp")
|
||||||
|
release_exe = subfolder.joinpath(appname)
|
||||||
|
output_exe.rename(release_exe)
|
||||||
|
|
||||||
combined_licenses = concat_license()
|
combined_licenses = concat_license()
|
||||||
license_file = subfolder.joinpath("LICENSE")
|
license_file = subfolder.joinpath("LICENSE")
|
||||||
license_file.write_text(combined_licenses)
|
license_file.write_text(combined_licenses)
|
||||||
|
|
||||||
|
with tarfile.open(tarpath, "w:gz") as tar:
|
||||||
proc = subprocess.run(["cargo", "build", "--release"], env=env, cwd=pyapp_dir)
|
info = tar.gettarinfo(subfolder)
|
||||||
if proc.returncode == 0:
|
tar.add(subfolder, arcname=appname, filter=update_uname)
|
||||||
output_exe = build_dir.joinpath("pyapp-latest/target/release/pyapp")
|
|
||||||
release_exe = subfolder.joinpath(appname)
|
|
||||||
output_exe.rename(release_exe)
|
|
||||||
tarpath = output.joinpath(tarname)
|
|
||||||
|
|
||||||
with tarfile.open(tarpath, "w:gz") as tar:
|
|
||||||
info = tar.gettarinfo(subfolder)
|
|
||||||
tar.add(subfolder, arcname="dzgui", 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)
|
proc = subprocess.run([release_exe, "-v"], capture_output=True, text=True)
|
||||||
@ -79,4 +99,3 @@ release_exe.unlink()
|
|||||||
license_file.unlink()
|
license_file.unlink()
|
||||||
subfolder.rmdir()
|
subfolder.rmdir()
|
||||||
Path(wheel).unlink()
|
Path(wheel).unlink()
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user