tahoe-lafs/nix/tahoe-lafs.nix

91 lines
2.6 KiB
Nix
Raw Normal View History

{ fetchFromGitHub, lib
, git, python
, twisted, foolscap, zfec
2019-12-09 14:48:15 +00:00
, setuptools, setuptoolsTrial, pyasn1, zope_interface
, service-identity, pyyaml, magic-wormhole, treq, appdirs
, beautifulsoup4, eliot, autobahn, cryptography, netifaces
2020-10-26 20:09:01 +00:00
, html5lib, pyutil, distro, configparser
2019-12-09 14:48:15 +00:00
}:
python.pkgs.buildPythonPackage rec {
version = "1.14.0.dev";
name = "tahoe-lafs-${version}";
src = lib.cleanSourceWith {
src = ../.;
filter = name: type:
let
basename = baseNameOf name;
split = lib.splitString ".";
join = builtins.concatStringsSep ".";
ext = join (builtins.tail (split basename));
# Build up a bunch of knowledge about what kind of file this is.
isTox = type == "directory" && basename == ".tox";
isTrialTemp = type == "directory" && basename == "_trial_temp";
isVersion = basename == "version.py";
isBytecode = ext == "pyc" || ext == "pyo";
isBackup = lib.hasSuffix "~" basename;
isTemporary = lib.hasPrefix "#" basename && lib.hasSuffix "#" basename;
isSymlink = type == "symlink";
in
# Exclude all these things
! (isTrialTemp
|| isTox
|| isVersion
|| isBytecode
|| isBackup
|| isTemporary
|| isSymlink
);
};
2019-12-09 14:48:15 +00:00
postPatch = ''
# Chroots don't have /etc/hosts and /etc/resolv.conf, so work around
# that.
for i in $(find src/allmydata/test -type f)
do
sed -i "$i" -e"s/localhost/127.0.0.1/g"
done
2019-12-10 20:29:16 +00:00
# Some tests are flaky or fail to skip when dependencies are missing.
# This list is over-zealous because it's more work to disable individual
# tests with in a module.
2019-12-18 14:04:47 +00:00
# Many of these tests don't properly skip when i2p or tor dependencies are
# not supplied (and we are not supplying them).
2019-12-10 20:29:16 +00:00
rm src/allmydata/test/test_i2p_provider.py
rm src/allmydata/test/test_connections.py
rm src/allmydata/test/cli/test_create.py
2021-03-09 15:38:49 +00:00
# Since we're deleting files, this complains they're missing. For now Nix
# is Python 2-only, anyway, so these tests don't add anything yet.
rm src/allmydata/test/test_python3.py
2019-12-09 14:48:15 +00:00
'';
nativeBuildInputs = [
git
];
2019-12-09 14:48:15 +00:00
propagatedBuildInputs = with python.pkgs; [
twisted foolscap zfec appdirs
2019-12-09 14:48:15 +00:00
setuptoolsTrial pyasn1 zope_interface
service-identity pyyaml magic-wormhole treq
eliot autobahn cryptography netifaces setuptools
2020-10-26 20:09:01 +00:00
future pyutil distro configparser
2019-12-09 14:48:15 +00:00
];
checkInputs = with python.pkgs; [
hypothesis
testtools
fixtures
2019-12-10 20:29:11 +00:00
beautifulsoup4
html5lib
2020-07-28 17:00:44 +00:00
tenacity
2019-12-09 14:48:15 +00:00
];
checkPhase = ''
2021-03-16 19:06:51 +00:00
${python}/bin/python -m twisted.trial -j $NIX_BUILD_CORES allmydata
2019-12-09 14:48:15 +00:00
'';
}