duden: refactor

- get rid of rec by using recursive let
- do not use python3.pkgs (oh that splicing dark magic)
- get rid of nested with
- set meta.mainProgram
- adopted by AndersonTorres
This commit is contained in:
Anderson Torres 2024-02-28 20:54:43 -03:00
parent 8a6251839a
commit b590908c9e

View file

@ -1,40 +1,56 @@
{ lib
, python3
, beautifulsoup4
, buildPythonPackage
, crayons
, fetchFromGitHub
, poetry-core
, pyxdg
, pyyaml
, requests
, setuptools
}:
python3.pkgs.buildPythonPackage rec {
pname = "duden";
version = "0.18.0";
format = "pyproject";
let
finalAttrs = {
pname = "duden";
version = "0.18.0";
pyproject = true;
src = fetchFromGitHub {
owner = "radomirbosak";
repo = "duden";
rev = version;
hash = "sha256-ZrarN09Znw4m6YiZxD7q7dTJ49WjmHDobLnOt8JCwvc=";
src = fetchFromGitHub {
owner = "radomirbosak";
repo = "duden";
rev = finalAttrs.version;
hash = "sha256-ZrarN09Znw4m6YiZxD7q7dTJ49WjmHDobLnOt8JCwvc=";
};
nativeBuildInputs = [
poetry-core
];
propagatedBuildInputs = [
beautifulsoup4
crayons
pyxdg
pyyaml
requests
setuptools
];
pythonImportsCheck = [ "duden" ];
meta = {
homepage = "https://github.com/radomirbosak/duden";
changelog = "https://github.com/radomirbosak/duden/blob/${finalAttrs.src.rev}/CHANGELOG.md";
description = "CLI for https://duden.de dictionary written in Python";
longDescription = ''
duden is a CLI-based program and python module, which can provide
various information about given german word. The provided data are
parsed from german dictionary duden.de.
'';
license = with lib.licenses; [ mit ];
mainProgram = "duden";
maintainers = with lib.maintainers; [ AndersonTorres ];
};
};
nativeBuildInputs = [
python3.pkgs.poetry-core
];
propagatedBuildInputs = with python3.pkgs; [
beautifulsoup4
crayons
pyxdg
pyyaml
requests
setuptools
];
pythonImportsCheck = [ "duden" ];
meta = with lib; {
description = "CLI for http://duden.de dictionary written in Python";
homepage = "https://github.com/radomirbosak/duden";
changelog = "https://github.com/radomirbosak/duden/blob/${src.rev}/CHANGELOG.md";
license = licenses.mit;
maintainers = with maintainers; [ ];
};
}
in
buildPythonPackage finalAttrs