fava: move to python3Packages (#461926)

This commit is contained in:
Bruno BELANYI
2025-11-16 11:53:30 +00:00
committed by GitHub
4 changed files with 114 additions and 93 deletions

View File

@@ -1,93 +1 @@
{
lib,
python3Packages,
buildNpmPackage,
fetchFromGitHub,
stdenv,
}:
let
src = buildNpmPackage (finalAttrs: {
pname = "fava-frontend";
version = "1.30.7";
src = fetchFromGitHub {
owner = "beancount";
repo = "fava";
tag = "v${finalAttrs.version}";
hash = "sha256-gO6eJIFp/yWAXFWhUcqkkfk2pA8/vyTxgPRPBmv4a6Q=";
};
sourceRoot = "${finalAttrs.src.name}/frontend";
npmDepsHash = "sha256-cXIhEzYFpLOxUEY7lhTWW7R3/ptkx7hB9K92Fd2m1Ng=";
makeCacheWritable = true;
preBuild = ''
chmod -R u+w ..
'';
installPhase = ''
runHook preInstall
cp -R .. $out
runHook postInstall
'';
});
in
python3Packages.buildPythonApplication {
pname = "fava";
inherit (src) version;
pyproject = true;
inherit src;
patches = [ ./dont-compile-frontend.patch ];
postPatch = ''
substituteInPlace tests/test_cli.py \
--replace-fail '"fava"' '"${placeholder "out"}/bin/fava"'
'';
build-system = [ python3Packages.setuptools-scm ];
dependencies = with python3Packages; [
babel
beancount
beangulp
beanquery
cheroot
click
flask
flask-babel
jinja2
markdown2
ply
simplejson
werkzeug
watchfiles
];
nativeCheckInputs = [ python3Packages.pytestCheckHook ];
# tests/test_cli.py
__darwinAllowLocalNetworking = true;
# flaky, fails only on ci
disabledTestPaths = lib.optionals stdenv.hostPlatform.isDarwin [ "tests/test_core_watcher.py" ];
env = {
# Disable some tests when building with beancount2
SNAPSHOT_IGNORE = lib.versions.major python3Packages.beancount.version == "2";
};
meta = {
description = "Web interface for beancount";
mainProgram = "fava";
homepage = "https://beancount.github.io/fava";
changelog = "https://beancount.github.io/fava/changelog.html";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [
bhipple
prince213
sigmanificient
];
};
}
{ python3Packages }: python3Packages.toPythonApplication python3Packages.fava

View File

@@ -0,0 +1,111 @@
{
lib,
buildPythonPackage,
buildNpmPackage,
fetchFromGitHub,
stdenv,
babel,
beancount,
beangulp,
beanquery,
cheroot,
click,
flask,
flask-babel,
jinja2,
markdown2,
ply,
pytestCheckHook,
setuptools-scm,
simplejson,
watchfiles,
werkzeug,
}:
let
src = buildNpmPackage (finalAttrs: {
pname = "fava-frontend";
version = "1.30.7";
src = fetchFromGitHub {
owner = "beancount";
repo = "fava";
tag = "v${finalAttrs.version}";
hash = "sha256-gO6eJIFp/yWAXFWhUcqkkfk2pA8/vyTxgPRPBmv4a6Q=";
};
sourceRoot = "${finalAttrs.src.name}/frontend";
npmDepsHash = "sha256-cXIhEzYFpLOxUEY7lhTWW7R3/ptkx7hB9K92Fd2m1Ng=";
makeCacheWritable = true;
preBuild = ''
chmod -R u+w ..
'';
installPhase = ''
runHook preInstall
cp -R .. $out
runHook postInstall
'';
});
in
buildPythonPackage {
pname = "fava";
inherit (src) version;
pyproject = true;
inherit src;
patches = [ ./dont-compile-frontend.patch ];
postPatch = ''
substituteInPlace tests/test_cli.py \
--replace-fail '"fava"' '"${placeholder "out"}/bin/fava"'
'';
build-system = [ setuptools-scm ];
dependencies = [
babel
beancount
beangulp
beanquery
cheroot
click
flask
flask-babel
jinja2
markdown2
ply
simplejson
werkzeug
watchfiles
];
nativeCheckInputs = [ pytestCheckHook ];
pythonImportsCheck = [ "fava" ];
# tests/test_cli.py
__darwinAllowLocalNetworking = true;
# flaky, fails only on ci
disabledTestPaths = lib.optionals stdenv.hostPlatform.isDarwin [ "tests/test_core_watcher.py" ];
env = {
# Disable some tests when building with beancount2
SNAPSHOT_IGNORE = lib.versions.major beancount.version == "2";
};
meta = {
description = "Web interface for beancount";
mainProgram = "fava";
homepage = "https://beancount.github.io/fava";
changelog = "https://beancount.github.io/fava/changelog.html";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [
bhipple
prince213
sigmanificient
];
};
}

View File

@@ -5206,6 +5206,8 @@ self: super: with self; {
faust-cchardet = callPackage ../development/python-modules/faust-cchardet { };
fava = callPackage ../development/python-modules/fava { };
favicon = callPackage ../development/python-modules/favicon { };
fe25519 = callPackage ../development/python-modules/fe25519 { };