mirror of
https://github.com/aclist/dztui.git
synced 2026-08-30 11:47:17 +02:00
Compare commits
No commits in common. "549d441179c0a4fc5f6f051faddb62b7f6ecdb5c" and "58a2bf0bfa54b7f991123a571520a16d182f1b20" have entirely different histories.
549d441179
...
58a2bf0bfa
@ -1,30 +1,23 @@
|
|||||||
# TODO: link to here from sphinx docs
|
# TODO: link to here from sphinx docs
|
||||||
|
|
||||||
## Installing from source
|
# Installing dev dependencies
|
||||||
|
uv pip install -e .[dev]
|
||||||
|
|
||||||
### Fetch submodules
|
# Setting up precommit hooks
|
||||||
git submodule update --recursive --init
|
|
||||||
|
|
||||||
### 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
|
pre-commit install
|
||||||
|
|
||||||
### Building documentation
|
# Fetching submodules
|
||||||
|
git submodule update --recursive --init
|
||||||
|
|
||||||
|
# Building documentation
|
||||||
sphinx-build -M html source build -a
|
sphinx-build -M html source build -a
|
||||||
|
|
||||||
### Building standalone release binaries
|
# Building standalone DZGUI release binaries
|
||||||
1. Set up the build target: `rustup target add x86_64-unknown-linux-musl`
|
1. Run `./scripts/dl_pyapp.sh`
|
||||||
2. Run `python3 scripts/release.py`
|
# TODO: secondary script that packs this archive
|
||||||
3. Generate a release and tag against the resulting tarfile generated in `dist`
|
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
|
||||||
|
|||||||
@ -1,51 +0,0 @@
|
|||||||
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,7 +1,6 @@
|
|||||||
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
|
||||||
@ -10,20 +9,19 @@ 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]
|
||||||
dist_dir = root.joinpath("dist")
|
output = 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=dist_dir)
|
wheel = builder.build("wheel", output_directory=output)
|
||||||
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]
|
||||||
@ -53,42 +51,24 @@ 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"
|
||||||
|
|
||||||
platform = "x86_64-unknown-linux-musl"
|
subfolder = output.joinpath(stem)
|
||||||
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:
|
|
||||||
info = tar.gettarinfo(subfolder)
|
proc = subprocess.run(["cargo", "build", "--release"], env=env, cwd=pyapp_dir)
|
||||||
tar.add(subfolder, arcname=appname, filter=update_uname)
|
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:
|
||||||
|
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)
|
||||||
@ -99,3 +79,4 @@ 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