NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.35k stars 13.58k forks source link

Package request: PyGlossary A tool for converting dictionary files aka glossaries. #330450

Open Birdthatcantfly opened 1 month ago

Birdthatcantfly commented 1 month ago

Project description

A tool for converting dictionary files aka glossaries.

The primary purpose is to be able to use our offline glossaries in any Open Source dictionary we like on any OS/device.

Metadata

Sigmanificient commented 1 month ago

May require patching?

AttributeError: module 'inspect' has no attribute 'getargspec'. Did you mean: 'getargs'?
{
  lib,
  python3Packages,
  fetchFromGitHub,
  gobject-introspection,
  gtk3,
  wrapGAppsHook
}:

python3Packages.buildPythonPackage rec {
  pname = "pyglossary";
  version = "4.7.0";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "ilius";
    repo = "pyglossary";
    rev = "refs/tags/${version}";
    hash = "sha256-ogyd9ZCPsEJR0eZk4m6Ar6HLauWTrJ6epcaobc88vpY=";
  };

  build-system = [ python3Packages.setuptools ];

  postPatch = ''
    # remove legacy install script that causes write error
    substituteInPlace setup.py \
      --replace-fail '"install": my_install,' ' '
  '';

  dependencies = with python3Packages; [
    lxml
    beautifulsoup4
    pyicu
    pygobject3
    pymorphy2
  ];

  builInputs = [ gtk3 ];

  nativeBuildInputs = [
    gobject-introspection
    wrapGAppsHook
  ];

  pythonImportsCheck = [ "pyglossary" ];

  nativeCheckInputs = [
    python3Packages.unittestCheckHook
  ];

  preCheck = ''
    export HOME=$(mktemp -d)
  '';

  meta = {
    description = "Converts dictionary files aka glossaries";
    homepage = "https://github.com/ilius/pyglossary";
    license = lib.licenses.gpl3Plus;
    maintainers = with lib.maintainers; [ sigmanificient ];
  };
}