at 23.05-pre 1.4 kB view raw
1{ lib 2, buildPythonPackage 3, fetchFromGitHub 4, fetchurl 5, importlib-resources 6, pytestCheckHook 7, python 8, pythonOlder 9}: 10let 11 table = fetchurl { 12 # See https://github.com/dahlia/iso4217/blob/main/setup.py#L19 13 url = "http://www.currency-iso.org/dam/downloads/lists/list_one.xml"; 14 hash = "sha256-bp8uTMR1YRaI2cJLo0kdt9xD4nNaWK+LdlheWQ26qy0="; 15 }; 16in 17buildPythonPackage rec { 18 pname = "iso4217"; 19 version = "1.11"; 20 format = "setuptools"; 21 22 disabled = pythonOlder "3.7"; 23 24 src = fetchFromGitHub { 25 owner = "dahlia"; 26 repo = pname; 27 rev = version; 28 hash = "sha256-zJYtEIrsuHKPwnSoRjyZC/0rgAZoNMZ0Oh8gQcIb20Q="; 29 }; 30 31 propagatedBuildInputs = lib.optionals (pythonOlder "3.9") [ 32 importlib-resources 33 ]; 34 35 checkInputs = [ 36 pytestCheckHook 37 ]; 38 39 preBuild = '' 40 # The table is already downloaded 41 export ISO4217_DOWNLOAD=0 42 # Copy the table file to satifiy the build process 43 cp -r ${table} $pname/table.xml 44 ''; 45 46 postInstall = '' 47 # Copy the table file 48 cp -r ${table} $out/${python.sitePackages}/$pname/table.xml 49 ''; 50 51 pytestFlagsArray = [ 52 "$pname/test.py" 53 ]; 54 55 pythonImportsCheck = [ 56 "iso4217" 57 ]; 58 59 meta = with lib; { 60 description = "ISO 4217 currency data package for Python"; 61 homepage = "https://github.com/dahlia/iso4217"; 62 license = with licenses; [ publicDomain ]; 63 maintainers = with maintainers; [ fab ]; 64 }; 65}