Compare commits

...

15 Commits

Author SHA1 Message Date
aclist
549d441179
Merge pull request #336 from aclist/fix/release-dir
Some checks are pending
Mirror to Codeberg / mirror-to-codeberg (push) Waiting to run
fix: use default build dir for caching
2026-06-05 20:29:35 +09:00
aclist
52f3ec4570 fix: use default build dir for caching 2026-06-05 20:28:37 +09:00
aclist
14752440d1
Merge pull request #335 from aclist/fix/libgi-check
fix: make debian check non-mandatory
2026-06-05 19:36:06 +09:00
aclist
b05c353914 fix: make debian check non-mandatory 2026-06-05 19:35:31 +09:00
aclist
b21b7c5a5d
Merge pull request #329 from aclist/chore/musl-build
chore: build musl release target
2026-06-05 19:32:02 +09:00
aclist
1b626130d5
Merge pull request #330 from aclist/feat/libgi-check
feat: check for missing local library
2026-06-05 19:21:17 +09:00
aclist
c080847efc docs: mention atomic dpendency flags
Some checks failed
Mirror to Codeberg / mirror-to-codeberg (push) Has been cancelled
2026-06-05 18:56:19 +09:00
aclist
40e244e05a docs: update build instructions 2026-06-05 18:36:41 +09:00
aclist
a1ef96094f feat: check for missing local library 2026-06-04 19:41:43 +09:00
aclist
8edb38f175 fix: use correct platform compat tags
Some checks are pending
Mirror to Codeberg / mirror-to-codeberg (push) Waiting to run
2026-06-04 19:37:49 +09:00
aclist
485d0721da
Merge branch 'dzgui7' into chore/musl-build 2026-06-04 19:32:58 +09:00
aclist
5b90068fe4 chore: wrap line 2026-06-04 19:26:53 +09:00
aclist
63a853af7c chore: update build flags 2026-06-04 14:12:09 +09:00
aclist
41b0e86fda docs: update DEVELOPERS.md 2026-06-03 19:35:30 +09:00
aclist
fa486c2b76 chore: build musl release target 2026-06-03 18:20:35 +09:00
3 changed files with 109 additions and 32 deletions

View File

@ -1,23 +1,30 @@
# TODO: link to here from sphinx docs
# Installing dev dependencies
uv pip install -e .[dev]
## Installing from source
# Setting up precommit hooks
pre-commit install
# Fetching submodules
### Fetch submodules
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
# Building standalone DZGUI release binaries
1. Run `./scripts/dl_pyapp.sh`
# TODO: secondary script that packs this archive
2. Download cpython 3.13, linux, gnu, v3
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
### Building standalone release binaries
1. Set up the build target: `rustup target add x86_64-unknown-linux-musl`
2. Run `python3 scripts/release.py`
3. Generate a release and tag against the resulting tarfile generated in `dist`

51
dzgui/init/libgi.py Normal file
View 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)

View File

@ -1,6 +1,7 @@
import build
import os
import subprocess
import sys
import tarfile
from pathlib import Path
@ -9,19 +10,20 @@ from concat_licenses import concat_license
from parse_toml import get_entrypoint
from prebuild import get_pyapp, rebuild_cpython
def update_uname(info: tarfile.TarInfo) -> tarfile.TarInfo:
info.uname = "dzgui"
info.gname = "users"
return info
root = Path(__file__).resolve().parents[1]
output = root.joinpath("dist")
dist_dir = root.joinpath("dist")
build_dir = root.joinpath("build")
builder = build.ProjectBuilder(root)
wheel = builder.build("wheel", output_directory=output)
wheel = builder.build("wheel", output_directory=dist_dir)
stem = Path(wheel).stem
tarname = f"{stem}.tar.gz"
metadata = stem.split("-")
appname = metadata[0]
@ -51,24 +53,42 @@ env["PYAPP_FULL_ISOLATION"] = "true"
env["PYAPP_DISTRIBUTION_PATH"] = str(cpython)
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)
output_exe = pyapp_dir.joinpath(f"target/{platform}/release/pyapp")
release_exe = subfolder.joinpath(appname)
output_exe.rename(release_exe)
combined_licenses = concat_license()
license_file = subfolder.joinpath("LICENSE")
license_file.write_text(combined_licenses)
proc = subprocess.run(["cargo", "build", "--release"], env=env, cwd=pyapp_dir)
if proc.returncode == 0:
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:
with tarfile.open(tarpath, "w:gz") as tar:
info = tar.gettarinfo(subfolder)
tar.add(subfolder, arcname="dzgui", filter=update_uname)
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)
@ -79,4 +99,3 @@ release_exe.unlink()
license_file.unlink()
subfolder.rmdir()
Path(wheel).unlink()