@@ -0,0 +1,52 @@
1+{ lib, python3Packages, fetchpatch }:
2+
3+# Packaging documentation at:
4+# https://github.com/pimutils/vdirsyncer/blob/0.16.7/docs/packaging.rst
5+python3Packages.buildPythonApplication rec {
6+ version = "0.16.7";
7+ pname = "vdirsyncer";
8+
9+ src = python3Packages.fetchPypi {
10+ inherit pname version;
11+ sha256 = "6c9bcfb9bcb01246c83ba6f8551cf54c58af3323210755485fc23bb7848512ef";
12+ };
13+
14+ propagatedBuildInputs = with python3Packages; [
15+ click click-log click-threading
16+ requests_toolbelt
17+ requests
18+ requests_oauthlib # required for google oauth sync
19+ atomicwrites
20+ ];
21+
22+ nativeBuildInputs = with python3Packages; [ setuptools_scm ];
23+
24+ checkInputs = with python3Packages; [ hypothesis pytest pytest-localserver pytest-subtesthack ];
25+
26+ patches = [
27+ # Fixes for hypothesis: https://github.com/pimutils/vdirsyncer/pull/779
28+ (fetchpatch {
29+ url = https://github.com/pimutils/vdirsyncer/commit/22ad88a6b18b0979c5d1f1d610c1d2f8f87f4b89.patch;
30+ sha256 = "0dbzj6jlxhdidnm3i21a758z83sdiwzhpd45pbkhycfhgmqmhjpl";
31+ })
32+ ];
33+
34+ postPatch = ''
35+ # Invalid argument: 'perform_health_check' is not a valid setting
36+ substituteInPlace tests/conftest.py \
37+ --replace "perform_health_check=False" ""
38+ substituteInPlace tests/unit/test_repair.py \
39+ --replace $'@settings(perform_health_check=False) # Using the random module for UIDs\n' ""
40+ '';
41+
42+ checkPhase = ''
43+ make DETERMINISTIC_TESTS=true test
44+ '';
45+
46+ meta = with lib; {
47+ homepage = https://github.com/pimutils/vdirsyncer;
48+ description = "Synchronize calendars and contacts";
49+ license = licenses.mit;
50+ maintainers = with maintainers; [ loewenheim ];
51+ };
52+}