summaryrefslogtreecommitdiffstats
path: root/pkgs/development/python-modules/certvalidator/default.nix
blob: ff2967b46aa7fc3bed7e93aa7f95c2314502a6a0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  setuptools,
  asn1crypto,
  oscrypto,
  cacert,
}:

buildPythonPackage (finalAttrs: {
  pname = "certvalidator";
  version = "0.11.1";
  pyproject = true;

  __structuredAttrs = true;

  src = fetchFromGitHub {
    owner = "wbond";
    repo = "certvalidator";
    tag = finalAttrs.version;
    hash = "sha256-yVF7t4FuU3C9fDg67JeM7LWZZh/mv5F4EKmjlO4AuBY=";
  };

  build-system = [ setuptools ];

  dependencies = [
    asn1crypto
    oscrypto
  ];

  nativeCheckInputs = [ cacert ];
  checkPhase = ''
    # Tests are run with a custom executor/loader
    # The regex to skip specific tests relies on negative lookahead of regular expressions
    # We're skipping the few tests that rely on the network, fetching CRLs, OCSP or remote certificates
    python -c 'import dev.tests; dev.tests.run("^(?!.*test_(basic_certificate_validator_tls|fetch|revocation|build_path)).*$")'
  '';
  pythonImportsCheck = [ "certvalidator" ];

  meta = {
    homepage = "https://github.com/wbond/certvalidator";
    description = "Validates X.509 certificates and paths";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ baloo ];
  };
})