Merge pull request #140274 from fabaff/pyefergy

This commit is contained in:
Sandro 2021-10-07 00:33:48 +02:00 committed by GitHub
commit 3f5379dde3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 98 additions and 0 deletions

View File

@ -0,0 +1,52 @@
{ lib
, buildPythonPackage
, fetchFromGitHub
, fetchurl
, pytestCheckHook
, python
}:
let
table = fetchurl {
# See https://github.com/dahlia/iso4217/blob/main/setup.py#L18
url = "http://www.currency-iso.org/dam/downloads/lists/list_one.xml";
sha256 = "0frhicc7s8gqglr41hzx61fic3ckvr4sg773ahp1s28n5by3y7ac";
};
in
buildPythonPackage rec {
pname = "iso4217";
version = "1.6";
src = fetchFromGitHub {
owner = "dahlia";
repo = pname;
rev = version;
sha256 = "0mdpf5a0xr5lrcfgvqi1sdn7ln2w6pkc3lg0laqkbx5mhxky0fla";
};
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
'';
pytestFlagsArray = [ "$pname/test.py" ];
pythonImportsCheck = [ "iso4217" ];
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 ];
};
}

View File

@ -0,0 +1,42 @@
{ lib
, aiohttp
, buildPythonPackage
, fetchFromGitHub
, iso4217
, pytestCheckHook
, pythonOlder
, pytz
}:
buildPythonPackage rec {
pname = "pyefergy";
version = "0.1.0";
format = "setuptools";
disabled = pythonOlder "3.8";
src = fetchFromGitHub {
owner = "tkdrob";
repo = pname;
rev = version;
sha256 = "0nm7dc5q4wvdpqxpirlc4nwm68lf3n2df6j5yy4m8wr294yb7a1k";
};
propagatedBuildInputs = [
aiohttp
iso4217
pytz
];
# Project has no tests
doCheck = false;
pythonImportsCheck = [ "pyefergy" ];
meta = with lib; {
description = "Python API library for Efergy energy meters";
homepage = "https://github.com/tkdrob/pyefergy";
license = with licenses; [ mit ];
maintainers = with maintainers; [ fab ];
};
}

View File

@ -3767,6 +3767,8 @@ in {
iso-639 = callPackage ../development/python-modules/iso-639 { };
iso4217 = callPackage ../development/python-modules/iso4217 { };
iso8601 = callPackage ../development/python-modules/iso8601 { };
isodate = callPackage ../development/python-modules/isodate { };
@ -6200,6 +6202,8 @@ in {
pyee = callPackage ../development/python-modules/pyee { };
pyefergy = callPackage ../development/python-modules/pyefergy { };
pyeight = callPackage ../development/python-modules/pyeight { };
pyelftools = callPackage ../development/python-modules/pyelftools { };