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