Skip to content
Snippets Groups Projects
Select Git revision
  • 223a194bc9b8beec0a51d894c429fa295b723ca7
  • main default protected
  • restricted-sqlite-strategies
  • compare-structured-sql-dumps
  • 235.backup-and-recovery.recovery
  • mypy
  • real-spender
  • github/fork/tp-la/real-spender
  • 260.metric-rejected-zkaps
  • implicit-lease-renewal-problems
  • mach-nix
  • github/fork/tp-la/deep-traverse
  • v0.0
13 results

setup.cfg

Blame
  • zkapauthorizer.nix 1.70 KiB
    { lib
    , buildPythonPackage, sphinx
    , attrs, zope_interface, aniso8601, twisted, tahoe-lafs, privacypass
    , fixtures, testtools, hypothesis, pyflakes, treq, coverage
    , hypothesisProfile ? null
    , collectCoverage ? false
    , testSuite ? null
    , trialArgs ? null
    }:
    let
      hypothesisProfile' = if hypothesisProfile == null then "default" else hypothesisProfile;
      testSuite' = if testSuite == null then "_zkapauthorizer" else testSuite;
      defaultTrialArgs = [ "--rterrors" ] ++ ( lib.optional ( ! collectCoverage ) "--jobs=4" );
      trialArgs' = if trialArgs == null then defaultTrialArgs else trialArgs;
      extraTrialArgs = builtins.concatStringsSep " " trialArgs';
    in
    buildPythonPackage rec {
      version = "0.0";
      pname = "zero-knowledge-access-pass-authorizer";
      name = "${pname}-${version}";
      src = lib.cleanSource ./.;
    
      outputs = [ "out" ] ++ (if collectCoverage then [ "doc" ] else [ ]);
    
      depsBuildBuild = [
        sphinx
      ];
    
      propagatedBuildInputs = [
        attrs
        zope_interface
        aniso8601
        twisted
        tahoe-lafs
        privacypass
      ];
    
      checkInputs = [
        coverage
        fixtures
        testtools
        hypothesis
        twisted
        treq
      ];
    
      checkPhase = ''
        runHook preCheck
        "${pyflakes}/bin/pyflakes" src/_zkapauthorizer
        ZKAPAUTHORIZER_HYPOTHESIS_PROFILE=${hypothesisProfile'} python -m ${if collectCoverage
          then "coverage run --branch --source _zkapauthorizer,twisted.plugins.zkapauthorizer --module"
          else ""
        } twisted.trial ${extraTrialArgs} ${testSuite'}
        runHook postCheck
      '';
    
      postCheck = if collectCoverage
        then ''
        python -m coverage html
        mkdir -p "$doc/share/doc/${name}"
        cp -vr .coverage htmlcov "$doc/share/doc/${name}"
        python -m coverage report
        ''
        else "";
    }