vdirsyncer: Convert to a python module (#87865)

* vdirsyncer: standardize derivation

Use toPythonApplication and use callPackage from python-packages.nix.
Make vdirsyncerStable somewhat functional again, but mark it as broken
for Python 3.6 or higher.

* vdirsyncer: use buildPythonPackage as it's a package now

* vdirsyncer: move to python-modules/

* vdirsyncer: Move disabled logic into expression
This commit is contained in:
Doron Behar
2020-05-17 11:19:40 +03:00
committed by GitHub
parent 6c195563e1
commit b3e7e67a5e
4 changed files with 90 additions and 17 deletions

View File

@@ -0,0 +1,109 @@
{ stdenv
, buildPythonPackage
, fetchFromGitHub
, isPy27
, fetchpatch
, rustPlatform
, pkg-config
, openssl
, CoreServices
, Security
, click
, click-log
, click-threading
, requests_toolbelt
, requests
, requests_oauthlib # required for google oauth sync
, atomicwrites
, milksnake
, shippai
, hypothesis
, pytest
, pytest-localserver
, pytest-subtesthack
, setuptools_scm
}:
# Packaging documentation at:
# https://github.com/untitaker/vdirsyncer/blob/master/docs/packaging.rst
buildPythonPackage rec {
version = "unstable-2018-08-05";
pname = "vdirsyncer";
name = "${pname}-${version}";
disabled = isPy27;
src = fetchFromGitHub {
owner = "spk";
repo = pname;
# fix-build-style branch, see https://github.com/pimutils/vdirsyncer/pull/798
rev = "2c62d03bd73f8b44a47c2e769ade046697896ae9";
sha256 = "1q6xvzz5rf5sqdaj3mdvhpgwy5b16isavgg7vardgjwqwv1yal28";
};
native = rustPlatform.buildRustPackage {
name = "${name}-native";
inherit src;
sourceRoot = "source/rust";
cargoSha256 = "0cqy0s55pkg6hww86h7qip4xaidh6g8lcypdj84n2x374jq38c5d";
nativeBuildInputs = [ pkg-config ];
buildInputs = [ openssl ] ++ stdenv.lib.optionals stdenv.isDarwin [ CoreServices Security ];
};
propagatedBuildInputs = [
click click-log click-threading
requests_toolbelt
requests
requests_oauthlib # required for google oauth sync
atomicwrites
milksnake
shippai
];
nativeBuildInputs = [
setuptools_scm
];
checkInputs = [
hypothesis
pytest
pytest-localserver
pytest-subtesthack
];
patches = [
(fetchpatch {
url = "https://github.com/pimutils/vdirsyncer/commit/7b636e8e40d69c495901f965b9c0686513659e44.patch";
sha256 = "0vl942ii5iad47y63v0ngmhfp37n30nxyk4j7h64b95fk38vfwx9";
})
];
postPatch = ''
# see https://github.com/pimutils/vdirsyncer/pull/805
substituteInPlace setup.cfg --replace --duration --durations
# for setuptools_scm:
echo 'Version: ${version}' >PKG-INFO
sed -i 's/spec.add_external_build(cmd=cmd/spec.add_external_build(cmd="true"/g' setup.py
# fixing test
sed -i "s/invalid value for \"--verbosity\"/invalid value for \\\'--verbosity\\\'/" tests/system/cli/test_sync.py
'';
preBuild = ''
mkdir -p rust/target/release
ln -s ${native}/lib/libvdirsyncer_rustext* rust/target/release/
'';
checkPhase = ''
rm -rf vdirsyncer
make DETERMINISTIC_TESTS=true PYTEST_ARGS="--deselect=tests/unit/utils/test_vobject.py::test_replace_uid --deselect=tests/unit/sync/test_sync.py::TestSyncMachine" test
'';
meta = with stdenv.lib; {
homepage = "https://github.com/pimutils/vdirsyncer";
description = "Synchronize calendars and contacts";
maintainers = with maintainers; [ matthiasbeyer gebner ];
license = licenses.mit;
};
}

View File

@@ -0,0 +1,88 @@
{ stdenv
, pythonAtLeast
, buildPythonPackage
, fetchPypi
, isPy27
, fetchpatch
, click
, click-log
, click-threading
, requests_toolbelt
, requests
, requests_oauthlib # required for google oauth sync
, atomicwrites
, milksnake
, shippai
, hypothesis
, pytest
, pytest-localserver
, pytest-subtesthack
, setuptools_scm
}:
# Packaging documentation at:
# https://github.com/pimutils/vdirsyncer/blob/0.16.7/docs/packaging.rst
buildPythonPackage rec {
version = "0.16.7";
pname = "vdirsyncer";
disabled = isPy27;
src = fetchPypi {
inherit pname version;
sha256 = "6c9bcfb9bcb01246c83ba6f8551cf54c58af3323210755485fc23bb7848512ef";
};
propagatedBuildInputs = [
click click-log click-threading
requests_toolbelt
requests
requests_oauthlib # required for google oauth sync
atomicwrites
];
nativeBuildInputs = [
setuptools_scm
];
checkInputs = [
hypothesis
pytest
pytest-localserver
pytest-subtesthack
];
patches = [
# Fixes for hypothesis: https://github.com/pimutils/vdirsyncer/pull/779
(fetchpatch {
url = "https://github.com/pimutils/vdirsyncer/commit/22ad88a6b18b0979c5d1f1d610c1d2f8f87f4b89.patch";
sha256 = "0dbzj6jlxhdidnm3i21a758z83sdiwzhpd45pbkhycfhgmqmhjpl";
})
];
postPatch = ''
# Invalid argument: 'perform_health_check' is not a valid setting
substituteInPlace tests/conftest.py \
--replace "perform_health_check=False" ""
substituteInPlace tests/unit/test_repair.py \
--replace $'@settings(perform_health_check=False) # Using the random module for UIDs\n' ""
'';
checkPhase = ''
make DETERMINISTIC_TESTS=true PYTEST_ARGS="--deselect=tests/system/cli/test_sync.py::test_verbosity" test
'';
# Tests started to fail lately, for any python version even as low as 3.5 but
# if you enable the check, you'll see even severer errors with a higher then
# 3.5 python version. Hence it's marked as broken for higher then 3.5 and the
# checks are disabled unconditionally. As a general end user advice, use the
# normal "unstable" `vdirsyncer` derivation, not this one.
doCheck = false;
meta = with stdenv.lib; {
homepage = "https://github.com/pimutils/vdirsyncer";
description = "Synchronize calendars and contacts";
license = licenses.mit;
# vdirsyncer (unstable) works with mainline python versions
broken = (pythonAtLeast "3.6");
maintainers = with maintainers; [ loewenheim ];
};
}