nix: add ucs-detect (#9506)
This makes `ucs-detect` available in our Nix environment so that we can run tests on our Unicode support. In the future, I'd like to modify our CI to run this too. This also adds a `./test/ucs-detect.sh` script that runs `ucs-detect` with consistent options that match the upstream test styles. Fwiw, I did try to write a simple libghostty-based Zig binary to run this automatically for us in CI but while libghostty-vt is very good, we don't yet have the proper APIs setup for actually setting up a Pty and sub processing commands and hooking them up to a VT stream. So, I punt that to the future.pull/9512/head
commit
14bae9ed0a
10
flake.nix
10
flake.nix
|
|
@ -50,8 +50,16 @@
|
|||
in {
|
||||
devShell.${system} = pkgs.callPackage ./nix/devShell.nix {
|
||||
zig = zig.packages.${system}."0.15.2";
|
||||
wraptest = pkgs.callPackage ./nix/wraptest.nix {};
|
||||
wraptest = pkgs.callPackage ./nix/pkgs/wraptest.nix {};
|
||||
zon2nix = zon2nix;
|
||||
|
||||
python3 = pkgs.python3.override {
|
||||
self = pkgs.python3;
|
||||
packageOverrides = pyfinal: pyprev: {
|
||||
blessed = pyfinal.callPackage ./nix/pkgs/blessed.nix {};
|
||||
ucs-detect = pyfinal.callPackage ./nix/pkgs/ucs-detect.nix {};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
packages.${system} = let
|
||||
|
|
|
|||
|
|
@ -136,6 +136,11 @@ in
|
|||
blueprint-compiler
|
||||
libadwaita
|
||||
gtk4
|
||||
|
||||
# Python packages
|
||||
(python3.withPackages (python-pkgs: [
|
||||
python-pkgs.ucs-detect
|
||||
]))
|
||||
]
|
||||
++ lib.optionals stdenv.hostPlatform.isLinux [
|
||||
# My nix shell environment installs the non-interactive version
|
||||
|
|
|
|||
|
|
@ -0,0 +1,37 @@
|
|||
{
|
||||
lib,
|
||||
buildPythonPackage,
|
||||
fetchPypi,
|
||||
pythonOlder,
|
||||
flit-core,
|
||||
six,
|
||||
wcwidth,
|
||||
}:
|
||||
buildPythonPackage rec {
|
||||
pname = "blessed";
|
||||
version = "1.23.0";
|
||||
pyproject = true;
|
||||
|
||||
disabled = pythonOlder "3.7";
|
||||
|
||||
src = fetchPypi {
|
||||
inherit pname version;
|
||||
hash = "sha256-VlkaMpZvcE9hMfFACvQVHZ6PX0FEEzpcoDQBl2Pe53s=";
|
||||
};
|
||||
|
||||
build-system = [flit-core];
|
||||
|
||||
propagatedBuildInputs = [
|
||||
wcwidth
|
||||
six
|
||||
];
|
||||
|
||||
doCheck = false;
|
||||
|
||||
meta = with lib; {
|
||||
homepage = "https://github.com/jquast/blessed";
|
||||
description = "Thin, practical wrapper around terminal capabilities in Python";
|
||||
maintainers = [];
|
||||
license = licenses.mit;
|
||||
};
|
||||
}
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
{
|
||||
lib,
|
||||
buildPythonPackage,
|
||||
fetchPypi,
|
||||
pythonOlder,
|
||||
setuptools,
|
||||
# Dependencies
|
||||
blessed,
|
||||
wcwidth,
|
||||
pyyaml,
|
||||
}:
|
||||
buildPythonPackage rec {
|
||||
pname = "ucs-detect";
|
||||
version = "1.0.8";
|
||||
pyproject = true;
|
||||
|
||||
disabled = pythonOlder "3.8";
|
||||
|
||||
src = fetchPypi {
|
||||
inherit version;
|
||||
pname = "ucs_detect";
|
||||
hash = "sha256-ihB+tZCd6ykdeXYxc6V1Q6xALQ+xdCW5yqSL7oppqJc=";
|
||||
};
|
||||
|
||||
dependencies = [
|
||||
blessed
|
||||
wcwidth
|
||||
pyyaml
|
||||
];
|
||||
|
||||
nativeBuildInputs = [setuptools];
|
||||
|
||||
doCheck = false;
|
||||
|
||||
meta = with lib; {
|
||||
description = "Measures number of Terminal column cells of wide-character codes";
|
||||
homepage = "https://github.com/jquast/ucs-detect";
|
||||
license = licenses.mit;
|
||||
maintainers = [];
|
||||
};
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
#!/bin/sh
|
||||
|
||||
# This runs ucs-detect with the same settings consistently so we can
|
||||
# compare our results over time. This is based on:
|
||||
# https://github.com/jquast/ucs-detect/blob/2958b7766783c92b3aad6a55e1e752cbe07ccaf3/data/ghostty.yaml
|
||||
ucs-detect \
|
||||
--limit-codepoints=5000 \
|
||||
--limit-words=5000 \
|
||||
--limit-errors=1000 \
|
||||
--quick=false \
|
||||
--stream=stderr
|
||||
Loading…
Reference in New Issue