nbPython3Packages: fix clightning pkgs

Also enable tests for the pyln-* pkgs.
This commit is contained in:
Erik Arvstedt 2022-05-05 20:43:10 +02:00 committed by Jonas Nick
parent 6bdf0ac3fb
commit f234e59ca5
No known key found for this signature in database
GPG Key ID: 4861DBF262123605
7 changed files with 44 additions and 71 deletions

View File

@ -14,7 +14,10 @@ let
plugins = with nbPython3Packages; { plugins = with nbPython3Packages; {
helpme = { description = "Walks you through setting up a c-lightning node, offering advice for common problems"; }; helpme = { description = "Walks you through setting up a c-lightning node, offering advice for common problems"; };
monitor = { description = "Helps you analyze the health of your peers and channels"; }; monitor = {
description = "Helps you analyze the health of your peers and channels";
extraPkgs = [ packaging ];
};
prometheus = { prometheus = {
description = "Lightning node exporter for the prometheus timeseries server"; description = "Lightning node exporter for the prometheus timeseries server";
extraPkgs = [ prometheus_client ]; extraPkgs = [ prometheus_client ];

View File

@ -3,11 +3,11 @@ autoconf, automake, libtool, libffi, requests }:
buildPythonPackage rec { buildPythonPackage rec {
pname = "coincurve"; pname = "coincurve";
version = "15.0.0"; version = "17.0.0";
src = fetchPypi { src = fetchPypi {
inherit pname version; inherit pname version;
sha256 = "0ras7qb4ib9sik703fcb9f3jrgq7nx5wvdgx9k1pshmrxl8lnlh6"; hash = "sha256-aNpVr/iYcClS/aPuBP1u1gu2uR+RnGknB4btdmtUi5M";
}; };
doCheck = false; doCheck = false;

View File

@ -4,6 +4,8 @@ let
joinmarketPkg = pkg: callPackage pkg { inherit (nbPkgs.joinmarket) version src; }; joinmarketPkg = pkg: callPackage pkg { inherit (nbPkgs.joinmarket) version src; };
clightningPkg = pkg: callPackage pkg { inherit (nbPkgs.pinned) clightning; }; clightningPkg = pkg: callPackage pkg { inherit (nbPkgs.pinned) clightning; };
unstable = (import ../nixpkgs-pinned.nix).nixpkgs-unstable;
in { in {
bencoderpyx = callPackage ./bencoderpyx {}; bencoderpyx = callPackage ./bencoderpyx {};
coincurve = callPackage ./coincurve {}; coincurve = callPackage ./coincurve {};
@ -26,15 +28,17 @@ in {
## Specific versions of packages that already exist in nixpkgs ## Specific versions of packages that already exist in nixpkgs
# base58 2.1.0, required by pyln-proto
base58 = callPackage ./specific-versions/base58.nix {};
# cryptography 3.3.2, required by joinmarketdaemon # cryptography 3.3.2, required by joinmarketdaemon
# Used in the private python package set for joinmarket (../joinmarket/default.nix) # Used in the private python package set for joinmarket (../joinmarket/default.nix)
cryptography_3_3_2 = callPackage ./specific-versions/cryptography { cryptography_3_3_2 = callPackage ./specific-versions/cryptography {
cryptography_vectors = callPackage ./specific-versions/cryptography/vectors.nix {}; cryptography_vectors = callPackage ./specific-versions/cryptography/vectors.nix {};
}; };
# cryptography 36.0.0, required by pyln-proto.
cryptography = callPackage "${unstable}/pkgs/development/python-modules/cryptography" {
Security = self.darwin.apple_sdk.frameworks.Security;
};
# autobahn 20.12.3, required by joinmarketclient # autobahn 20.12.3, required by joinmarketclient
autobahn = callPackage ./specific-versions/autobahn.nix {}; autobahn = callPackage ./specific-versions/autobahn.nix {};

View File

@ -1,22 +1,17 @@
{ buildPythonPackage, clightning, pyln-proto }: { buildPythonPackage, poetry-core, pytestCheckHook, clightning, pyln-proto }:
buildPythonPackage rec { buildPythonPackage rec {
pname = "pyln-bolt7"; pname = "pyln-bolt7";
# The version is defined here:
# See fn `bolt_meta` in # https://github.com/ElementsProject/lightning/blob/master/contrib/pyln-spec/bolt7/pyproject.toml
# https://github.com/ElementsProject/lightning/blob/master/contrib/pyln-spec/bolt7/setup.py version = "1.0.2.186.post0";
version = "1.0.2.186"; format = "pyproject";
inherit (clightning) src; inherit (clightning) src;
nativeBuildInputs = [ poetry-core ];
propagatedBuildInputs = [ pyln-proto ]; propagatedBuildInputs = [ pyln-proto ];
checkInputs = [ pytestCheckHook ];
postUnpack = "sourceRoot=$sourceRoot/contrib/pyln-spec/bolt7"; postUnpack = "sourceRoot=$sourceRoot/contrib/pyln-spec/bolt7";
# TODO-EXTERNAL:
# Remove when this fix is released
# https://github.com/ElementsProject/lightning/pull/4910
postPatch = ''
sed -i 's|pyln.proto|pyln-proto|' requirements.txt
'';
} }

View File

@ -1,14 +1,27 @@
{ buildPythonPackage, clightning, pyln-bolt7, recommonmark, setuptools-scm }: { buildPythonPackage, poetry-core, pytestCheckHook, clightning, pyln-bolt7, pyln-proto }:
buildPythonPackage rec { buildPythonPackage rec {
pname = "pyln-client"; pname = "pyln-client";
version = clightning.version; version = clightning.version;
format = "pyproject";
inherit (clightning) src; inherit (clightning) src;
propagatedBuildInputs = [ pyln-bolt7 recommonmark setuptools-scm ]; nativeBuildInputs = [ poetry-core ];
SETUPTOOLS_SCM_PRETEND_VERSION = version; propagatedBuildInputs = [
pyln-bolt7
pyln-proto
];
checkInputs = [ pytestCheckHook ];
postUnpack = "sourceRoot=$sourceRoot/contrib/${pname}"; postUnpack = "sourceRoot=$sourceRoot/contrib/${pname}";
# Fix version typo in pyproject.toml
# TODO-EXTERNAL:
# This is already fixed upstream. Remove this after the next clightning release.
postPatch = ''
sed -i 's|pyln-bolt7 = "^1.0.186"|pyln-bolt7 = "^1.0.2.186"|' pyproject.toml
'';
} }

View File

@ -1,38 +1,30 @@
{ buildPythonPackage, clightning { buildPythonPackage
, clightning
, poetry-core
, pytestCheckHook
, bitstring , bitstring
, cryptography , cryptography
, coincurve , coincurve
, base58 , base58
, mypy
, pycparser
, setuptools-scm
}: }:
buildPythonPackage rec { buildPythonPackage rec {
pname = "pyln-proto"; pname = "pyln-proto";
version = clightning.version; version = clightning.version;
format = "pyproject";
inherit (clightning) src; inherit (clightning) src;
nativeBuildInputs = [ poetry-core ];
propagatedBuildInputs = [ propagatedBuildInputs = [
bitstring bitstring
cryptography cryptography
coincurve coincurve
pycparser
base58 base58
mypy
setuptools-scm
]; ];
SETUPTOOLS_SCM_PRETEND_VERSION = version; checkInputs = [ pytestCheckHook ];
postUnpack = "sourceRoot=$sourceRoot/contrib/pyln-proto"; postUnpack = "sourceRoot=$sourceRoot/contrib/pyln-proto";
postPatch = ''
sed -i '
s|pycparser==2.20|pycparser~=2.20|
s|coincurve ~= 13.0|coincurve == 15.0.0|
s|base58 ~= 2.0.1|base58 == 2.1.0|
s|mypy==0.790|mypy == 0.812|
' requirements.txt
'';
} }

View File

@ -1,34 +0,0 @@
{ lib
, buildPythonPackage
, fetchPypi
, pyhamcrest
, pytest-benchmark
, pytestCheckHook
, pythonOlder
}:
buildPythonPackage rec {
pname = "base58";
version = "2.1.0";
disabled = pythonOlder "3.5";
src = fetchPypi {
inherit pname version;
sha256 = "sha256-FxpUe0o8YeGuOAciSm967HXjZMQ5XnViZJ1zNXaAAaI=";
};
checkInputs = [
pyhamcrest
pytest-benchmark
pytestCheckHook
];
pythonImportsCheck = [ "base58" ];
meta = with lib; {
description = "Base58 and Base58Check implementation";
homepage = "https://github.com/keis/base58";
license = licenses.mit;
maintainers = with maintainers; [ nyanloutre ];
};
}