Skip to content
Snippets Groups Projects
zkapauthorizer.nix 1.86 KiB
Newer Older
  • Learn to ignore specific revisions
  • { lib
    
    , buildPythonPackage, sphinx, git
    
    , attrs, zope_interface, aniso8601, twisted, tahoe-lafs, challenge-bypass-ristretto, treq
    
    , fixtures, testtools, hypothesis, pyflakes, coverage
    
    , collectCoverage ? false
    
    , testSuite ? null
    
    let
      hypothesisProfile' = if hypothesisProfile == null then "default" else hypothesisProfile;
    
      testSuite' = if testSuite == null then "_zkapauthorizer" else testSuite;
    
      defaultTrialArgs = [ "--rterrors" ] ++ ( lib.optional ( ! collectCoverage ) "--jobs=$NIX_BUILD_CORES" );
    
      trialArgs' = if trialArgs == null then defaultTrialArgs else trialArgs;
      extraTrialArgs = builtins.concatStringsSep " " trialArgs';
    
    buildPythonPackage rec {
      version = "0.0";
    
      pname = "zero-knowledge-access-pass-authorizer";
      name = "${pname}-${version}";
    
      outputs = [ "out" ] ++ (if collectCoverage then [ "doc" ] else [ ]);
    
      depsBuildBuild = [
    
      patches = [
        # Remove the Tahoe-LAFS version pin in distutils config.  We have our own
        # pinning and also our Tahoe-LAFS package has a bogus version number. :/
        ./nix/setup.cfg.patch
      ];
    
    
      propagatedBuildInputs = [
    
        # Inherit eliot from tahoe-lafs
        # eliot
    
        challenge-bypass-ristretto
    
        fixtures
    
        hypothesis
    
        runHook preCheck
        "${pyflakes}/bin/pyflakes" src/_zkapauthorizer
    
        ZKAPAUTHORIZER_HYPOTHESIS_PROFILE=${hypothesisProfile'} python -m ${if collectCoverage
    
          then "coverage run --debug=config --module"
    
        } twisted.trial ${extraTrialArgs} ${testSuite'}
    
      postCheck = if collectCoverage
        then ''
    
        mkdir -p "$doc/share/doc/${name}"
    
        cp -v .coverage.* "$doc/share/doc/${name}"