1{ 2 lib, 3 buildPythonPackage, 4 pythonOlder, 5 fetchFromGitHub, 6 fetchpatch2, 7 poetry-core, 8 pytestCheckHook, 9}: 10 11buildPythonPackage rec { 12 pname = "pycountry"; 13 version = "23.12.11"; 14 pyproject = true; 15 16 disabled = pythonOlder "3.8"; 17 18 src = fetchFromGitHub { 19 owner = "pycountry"; 20 repo = "pycountry"; 21 rev = "refs/tags/${version}"; 22 hash = "sha256-B6kphZZZgK0YuPSmkiQNbEqEfqOQb+WZGnO2UeEqQN4="; 23 }; 24 25 patches = [ 26 (fetchpatch2 { 27 name = "fix-usage-of-importlib_metadata.patch"; 28 url = "https://github.com/pycountry/pycountry/commit/824d2535833d061c04a1f1b6b964f42bb53bced2.patch"; 29 excludes = [ 30 "HISTORY.txt" 31 "poetry.lock" 32 "pyproject.toml" 33 ]; 34 hash = "sha256-U4fbZP++d6YfTJkVG3k2rBC8nOF9NflM6+ONlwBNu+g="; 35 }) 36 ]; 37 38 postPatch = '' 39 sed -i "/addopts/d" pytest.ini 40 ''; 41 42 nativeBuildInputs = [ poetry-core ]; 43 44 nativeCheckInputs = [ pytestCheckHook ]; 45 46 pythonImportsCheck = [ "pycountry" ]; 47 48 meta = { 49 homepage = "https://github.com/pycountry/pycountry"; 50 changelog = "https://github.com/pycountry/pycountry/blob/${src.rev}/HISTORY.txt"; 51 description = "ISO country, subdivision, language, currency and script definitions and their translations"; 52 license = lib.licenses.lgpl21Plus; 53 maintainers = with lib.maintainers; [ dotlambda ]; 54 }; 55}