Merge pull request #92786 from flokli/certbot-with-plugins

certbot: add certbot.withPlugins
This commit is contained in:
Florian Klink 2020-07-22 12:53:07 +02:00 committed by GitHub
commit 3d50d643f9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 42 additions and 20 deletions

View file

@ -1,12 +1,13 @@
{ lib
, buildPythonApplication
, buildPythonPackage
, python, runCommand
, fetchFromGitHub
, ConfigArgParse, acme, configobj, cryptography, distro, josepy, parsedatetime, pyRFC3339, pyopenssl, pytz, requests, six, zope_component, zope_interface
, dialog, mock, gnureadline
, pytest_xdist, pytest, dateutil
, pytest_xdist, pytest, pytestCheckHook, dateutil
}:
buildPythonApplication rec {
buildPythonPackage rec {
pname = "certbot";
version = "1.6.0";
@ -17,6 +18,8 @@ buildPythonApplication rec {
sha256 = "1y0m5qm853i6pcpb2mrf8kjkr9wr80mdrx1qmck38ayvr2v2p5lc";
};
sourceRoot = "source/${pname}";
propagatedBuildInputs = [
ConfigArgParse
acme
@ -36,21 +39,32 @@ buildPythonApplication rec {
buildInputs = [ dialog mock gnureadline ];
checkInputs = [ pytest_xdist pytest dateutil ];
checkInputs = [
dateutil
pytest
pytestCheckHook
pytest_xdist
];
preBuild = ''
cd certbot
'';
postInstall = ''
for i in $out/bin/*; do
wrapProgram "$i" --prefix PYTHONPATH : "$PYTHONPATH" \
--prefix PATH : "${dialog}/bin:$PATH"
done
'';
pytestFlagsArray = [ "-o cache_dir=$(mktemp -d)" ];
doCheck = true;
makeWrapperArgs = [ "--prefix PATH : ${dialog}/bin" ];
# certbot.withPlugins has a similar calling convention as python*.withPackages
# it gets invoked with a lambda, and invokes that lambda with the python package set matching certbot's:
# certbot.withPlugins (cp: [ cp.certbot-dns-foo ])
passthru.withPlugins = f: let
pythonEnv = python.withPackages f;
in runCommand "certbot-with-plugins" {
} ''
mkdir -p $out/bin
cd $out/bin
ln -s ${pythonEnv}/bin/certbot
'';
meta = with lib; {
homepage = src.meta.homepage;
description = "ACME client that can obtain certs and extensibly update server configurations";

View file

@ -11598,7 +11598,13 @@ in
ogre = ogre1_10;
};
certbot = python3Packages.callPackage ../tools/admin/certbot { };
certbot = python3.pkgs.toPythonApplication python3.pkgs.certbot;
certbot-full = certbot.withPlugins (cp: with cp; [
certbot-dns-cloudflare
certbot-dns-rfc2136
certbot-dns-route53
]);
caf = callPackage ../development/libraries/caf {};

View file

@ -585,6 +585,8 @@ in {
cdecimal = callPackage ../development/python-modules/cdecimal { };
certbot = callPackage ../development/python-modules/certbot { };
certbot-dns-cloudflare = callPackage ../development/python-modules/certbot-dns-cloudflare { };
certbot-dns-rfc2136 = callPackage ../development/python-modules/certbot-dns-rfc2136 { };