Skip to content
Snippets Groups Projects
Commit e227af17 authored by Tom Prince's avatar Tom Prince
Browse files

Remove old nix config.

parent 1948a917
No related branches found
No related tags found
1 merge request!239Switch to using mach-nix for python packaging.
{ pkgs ? import <nixpkgs> { }
, hypothesisProfile ? null
, collectCoverage ? false
, testSuite ? null
, trialArgs ? null
, tahoe-lafs ? "1.14.0"
}:
let
tahoe-packages = {
"1.14.0" = pkgs.python2Packages.tahoe-lafs-1_14;
"1.16.0rc1" = pkgs.python2Packages.callPackage ./nix/tahoe-lafs-1_16.nix { };
};
tahoe-lafs' = builtins.getAttr tahoe-lafs tahoe-packages;
pkgs' = pkgs.extend (import ./overlays.nix);
callPackage = pkgs'.python27Packages.callPackage;
in
callPackage ./zkapauthorizer.nix {
challenge-bypass-ristretto = callPackage ./python-challenge-bypass-ristretto.nix { };
inherit hypothesisProfile collectCoverage testSuite trialArgs;
tahoe-lafs = tahoe-lafs';
}
{ fetchFromGitHub }:
fetchFromGitHub {
owner = "fenn-cs";
repo = "tahoe-lafs";
rev = "f6a96ae3976ee21ad0376f7b6a22fc3d12110dce";
sha256 = "sha256:127z83c388mvxkz1qdjqdnlj5xgshyn5w5v40vda6mpyy7k9bpb4";
}
diff --git a/setup.cfg b/setup.cfg
index dfc49607..822ea8dd 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -40,5 +40,5 @@ install_requires =
# incompatible with Tahoe-LAFS'. So duplicate them here (the ones that
# have been observed to cause problems).
Twisted[tls,conch]>=18.4.0
- tahoe-lafs >=1.14, <1.17, !=1.15.*
+ tahoe-lafs
treq
[versioneer]
{ callPackage }:
let
repo = callPackage ./repo-1_16_0_rc1.nix { };
tahoe-lafs = callPackage "${repo}/nix" { };
in
tahoe-lafs
self: super: {
ristretto = super.callPackage ./ristretto.nix { };
python27 = super.python27.override {
packageOverrides = python-self: python-super: {
# The newest typing is incompatible with the packaged version of
# Hypothesis. Upgrading Hypothesis is like pulling on a loose thread in
# a sweater. I pulled it as far as pytest where I found there was no
# upgrade route because pytest has dropped Python 2 support.
# Fortunately, downgrading typing ends up being fairly straightforward.
#
# For now. This is, no doubt, a sign of things to come for the Python 2
# ecosystem - the early stages of a slow, painful death by the thousand
# cuts of incompatibilities between libraries with no maintained Python
# 2 support.
typing = python-self.callPackage ./typing.nix { };
};
};
}
let
pkgs = import <nixpkgs> {};
in
pkgs.fetchFromGitHub {
owner = "LeastAuthority";
repo = "python-challenge-bypass-ristretto";
rev = "f1a7cfab1a7f1bf8b3345c228c2183064889ad83";
sha256 = "12myak2jwaisljs7bmx1vydgd0fnxvkaisk4zsf0kshwxrlnyh3x";
}
\ No newline at end of file
{ callPackage }:
let
src = import ./python-challenge-bypass-ristretto-repo.nix;
python-challenge-bypass-ristretto = callPackage "${src}" { };
in
python-challenge-bypass-ristretto.overrideAttrs (old: {
patches = [
./remove-setuptools-scm.patch
];
})
{ lib, buildPythonPackage, fetchPypi, pythonOlder, isPy3k, isPyPy, python }:
let
testDir = if isPy3k then "src" else "python2";
in buildPythonPackage rec {
pname = "typing";
version = "3.6.6";
src = fetchPypi {
inherit pname version;
sha256 = "sha256:0ba9acs4awx15bf9v3nrs781msbd2nx826906nj6fqks2bvca9s0";
};
# Error for Python3.6: ImportError: cannot import name 'ann_module'
# See https://github.com/python/typing/pull/280
# Also, don't bother on PyPy: AssertionError: TypeError not raised
doCheck = pythonOlder "3.6" && !isPyPy;
checkPhase = ''
cd ${testDir}
${python.interpreter} -m unittest discover
'';
meta = with lib; {
description = "Backport of typing module to Python versions older than 3.5";
homepage = https://docs.python.org/3/library/typing.html;
license = licenses.psfl;
};
}
{ lib
, buildPythonPackage, sphinx, git
, attrs, zope_interface, aniso8601, twisted, tahoe-lafs, challenge-bypass-ristretto, treq
, fixtures, testtools, hypothesis, pyflakes, 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=$NIX_BUILD_CORES" );
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 = ./.;
outputs = [ "out" ] ++ (if collectCoverage then [ "doc" ] else [ ]);
depsBuildBuild = [
git
sphinx
];
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 = [
aniso8601
tahoe-lafs
challenge-bypass-ristretto
# Inherit some things from tahoe-lafs to avoid conflicting versions
#
# attrs
# zope_interface
# twisted
# eliot
# treq
];
checkInputs = [
coverage
fixtures
testtools
hypothesis
];
checkPhase = ''
runHook preCheck
"${pyflakes}/bin/pyflakes" src/_zkapauthorizer
ZKAPAUTHORIZER_HYPOTHESIS_PROFILE=${hypothesisProfile'} python -m ${if collectCoverage
then "coverage run --debug=config --module"
else ""
} twisted.trial ${extraTrialArgs} ${testSuite'}
runHook postCheck
'';
postCheck = if collectCoverage
then ''
mkdir -p "$doc/share/doc/${name}"
cp -v .coverage.* "$doc/share/doc/${name}"
''
else "";
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment