about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/python-modules/pycountry/default.nix
blob: 75287c6cbf6b24fe9886afdf29690e69efa4f957 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
{ lib
, buildPythonPackage
, pythonOlder
, fetchFromGitHub
, fetchpatch2
, poetry-core
, pytestCheckHook
}:

buildPythonPackage rec {
  pname = "pycountry";
  version = "23.12.11";
  pyproject = true;

  disabled = pythonOlder "3.8";

  src = fetchFromGitHub {
    owner = "pycountry";
    repo = "pycountry";
    rev = "refs/tags/${version}";
    hash = "sha256-B6kphZZZgK0YuPSmkiQNbEqEfqOQb+WZGnO2UeEqQN4=";
  };

  patches = [
    (fetchpatch2 {
      name = "fix-usage-of-importlib_metadata.patch";
      url = "https://github.com/pycountry/pycountry/commit/824d2535833d061c04a1f1b6b964f42bb53bced2.patch";
      excludes = [ "HISTORY.txt" "poetry.lock" "pyproject.toml" ];
      hash = "sha256-U4fbZP++d6YfTJkVG3k2rBC8nOF9NflM6+ONlwBNu+g=";
    })
  ];

  postPatch = ''
    sed -i "/addopts/d" pytest.ini
  '';

  nativeBuildInputs = [
    poetry-core
  ];

  nativeCheckInputs = [
    pytestCheckHook
  ];

  pythonImportsCheck = [
    "pycountry"
  ];

  meta = {
    homepage = "https://github.com/pycountry/pycountry";
    changelog = "https://github.com/pycountry/pycountry/blob/${src.rev}/HISTORY.txt";
    description = "ISO country, subdivision, language, currency and script definitions and their translations";
    license = lib.licenses.lgpl21Plus;
    maintainers = with lib.maintainers; [ dotlambda ];
  };
}