2021-10-07 14:46:35 +00:00
|
|
|
{ lib
|
|
|
|
, buildPythonPackage
|
|
|
|
, fetchFromGitHub
|
|
|
|
, fetchurl
|
2021-12-30 13:39:12 +00:00
|
|
|
, importlib-resources
|
2021-10-07 14:46:35 +00:00
|
|
|
, pytestCheckHook
|
|
|
|
, python
|
2021-12-30 13:39:12 +00:00
|
|
|
, pythonOlder
|
2021-10-07 14:46:35 +00:00
|
|
|
}:
|
|
|
|
let
|
|
|
|
table = fetchurl {
|
2021-12-30 13:39:12 +00:00
|
|
|
# See https://github.com/dahlia/iso4217/blob/main/setup.py#L19
|
2021-10-07 14:46:35 +00:00
|
|
|
url = "http://www.currency-iso.org/dam/downloads/lists/list_one.xml";
|
2021-12-30 13:39:12 +00:00
|
|
|
hash = "sha256-bp8uTMR1YRaI2cJLo0kdt9xD4nNaWK+LdlheWQ26qy0=";
|
2021-10-07 14:46:35 +00:00
|
|
|
};
|
|
|
|
in
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "iso4217";
|
2022-02-20 05:27:41 +00:00
|
|
|
version = "1.8";
|
2021-12-30 13:39:12 +00:00
|
|
|
format = "setuptools";
|
2021-10-07 14:46:35 +00:00
|
|
|
|
2022-02-20 05:27:41 +00:00
|
|
|
disabled = pythonOlder "3.7";
|
|
|
|
|
2021-10-07 14:46:35 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "dahlia";
|
|
|
|
repo = pname;
|
|
|
|
rev = version;
|
2022-02-20 05:27:41 +00:00
|
|
|
hash = "sha256-L0vx6Aan6D1lusgBh/pcT373ZTxbtWpQnFKB2V0dxlA=";
|
2021-10-07 14:46:35 +00:00
|
|
|
};
|
|
|
|
|
2021-12-30 13:39:12 +00:00
|
|
|
propagatedBuildInputs = lib.optionals (pythonOlder "3.9") [
|
|
|
|
importlib-resources
|
|
|
|
];
|
|
|
|
|
2021-10-07 14:46:35 +00:00
|
|
|
checkInputs = [
|
|
|
|
pytestCheckHook
|
|
|
|
];
|
|
|
|
|
|
|
|
preBuild = ''
|
|
|
|
# The table is already downloaded
|
|
|
|
export ISO4217_DOWNLOAD=0
|
|
|
|
# Copy the table file to satifiy the build process
|
|
|
|
cp -r ${table} $pname/table.xml
|
|
|
|
'';
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
# Copy the table file
|
|
|
|
cp -r ${table} $out/${python.sitePackages}/$pname/table.xml
|
|
|
|
'';
|
|
|
|
|
2021-12-30 13:39:12 +00:00
|
|
|
pytestFlagsArray = [
|
|
|
|
"$pname/test.py"
|
|
|
|
];
|
2021-10-07 14:46:35 +00:00
|
|
|
|
2021-12-30 13:39:12 +00:00
|
|
|
pythonImportsCheck = [
|
|
|
|
"iso4217"
|
|
|
|
];
|
2021-10-07 14:46:35 +00:00
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "ISO 4217 currency data package for Python";
|
|
|
|
homepage = "https://github.com/dahlia/iso4217";
|
|
|
|
license = with licenses; [ publicDomain ];
|
|
|
|
maintainers = with maintainers; [ fab ];
|
|
|
|
};
|
|
|
|
}
|