From b3e7e67a5e7fe812fed3fe3b83d22fa853eda2a4 Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Sun, 17 May 2020 11:19:40 +0300 Subject: [PATCH] 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 --- .../python-modules}/vdirsyncer/default.nix | 44 +++++++++++++--- .../python-modules}/vdirsyncer/stable.nix | 50 ++++++++++++++++--- pkgs/top-level/all-packages.nix | 6 +-- pkgs/top-level/python-packages.nix | 7 +++ 4 files changed, 90 insertions(+), 17 deletions(-) rename pkgs/{tools/misc => development/python-modules}/vdirsyncer/default.nix (77%) rename pkgs/{tools/misc => development/python-modules}/vdirsyncer/stable.nix (55%) diff --git a/pkgs/tools/misc/vdirsyncer/default.nix b/pkgs/development/python-modules/vdirsyncer/default.nix similarity index 77% rename from pkgs/tools/misc/vdirsyncer/default.nix rename to pkgs/development/python-modules/vdirsyncer/default.nix index 61c9b9df8772..1a5494634bb0 100644 --- a/pkgs/tools/misc/vdirsyncer/default.nix +++ b/pkgs/development/python-modules/vdirsyncer/default.nix @@ -1,11 +1,36 @@ -{ stdenv, python3Packages, fetchFromGitHub, fetchpatch, rustPlatform, pkgconfig, openssl, CoreServices, Security }: +{ 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 -python3Packages.buildPythonApplication rec { +buildPythonPackage rec { version = "unstable-2018-08-05"; pname = "vdirsyncer"; name = "${pname}-${version}"; + disabled = isPy27; src = fetchFromGitHub { owner = "spk"; @@ -20,11 +45,11 @@ python3Packages.buildPythonApplication rec { inherit src; sourceRoot = "source/rust"; cargoSha256 = "0cqy0s55pkg6hww86h7qip4xaidh6g8lcypdj84n2x374jq38c5d"; - nativeBuildInputs = [ pkgconfig ]; + nativeBuildInputs = [ pkg-config ]; buildInputs = [ openssl ] ++ stdenv.lib.optionals stdenv.isDarwin [ CoreServices Security ]; }; - propagatedBuildInputs = with python3Packages; [ + propagatedBuildInputs = [ click click-log click-threading requests_toolbelt requests @@ -34,9 +59,16 @@ python3Packages.buildPythonApplication rec { shippai ]; - nativeBuildInputs = with python3Packages; [ setuptools_scm ]; + nativeBuildInputs = [ + setuptools_scm + ]; - checkInputs = with python3Packages; [ hypothesis pytest pytest-localserver pytest-subtesthack ]; + checkInputs = [ + hypothesis + pytest + pytest-localserver + pytest-subtesthack + ]; patches = [ (fetchpatch { diff --git a/pkgs/tools/misc/vdirsyncer/stable.nix b/pkgs/development/python-modules/vdirsyncer/stable.nix similarity index 55% rename from pkgs/tools/misc/vdirsyncer/stable.nix rename to pkgs/development/python-modules/vdirsyncer/stable.nix index ada70678e34f..cb90bfbc5988 100644 --- a/pkgs/tools/misc/vdirsyncer/stable.nix +++ b/pkgs/development/python-modules/vdirsyncer/stable.nix @@ -1,17 +1,38 @@ -{ lib, python3Packages, fetchpatch }: +{ 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 -python3Packages.buildPythonApplication rec { +buildPythonPackage rec { version = "0.16.7"; pname = "vdirsyncer"; + disabled = isPy27; - src = python3Packages.fetchPypi { + src = fetchPypi { inherit pname version; sha256 = "6c9bcfb9bcb01246c83ba6f8551cf54c58af3323210755485fc23bb7848512ef"; }; - propagatedBuildInputs = with python3Packages; [ + propagatedBuildInputs = [ click click-log click-threading requests_toolbelt requests @@ -19,9 +40,16 @@ python3Packages.buildPythonApplication rec { atomicwrites ]; - nativeBuildInputs = with python3Packages; [ setuptools_scm ]; + nativeBuildInputs = [ + setuptools_scm + ]; - checkInputs = with python3Packages; [ hypothesis pytest pytest-localserver pytest-subtesthack ]; + checkInputs = [ + hypothesis + pytest + pytest-localserver + pytest-subtesthack + ]; patches = [ # Fixes for hypothesis: https://github.com/pimutils/vdirsyncer/pull/779 @@ -42,11 +70,19 @@ python3Packages.buildPythonApplication rec { 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 lib; { + 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 ]; }; } diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 7e32522158ce..fc8f53db0ad2 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -22369,11 +22369,9 @@ in vcv-rack = callPackage ../applications/audio/vcv-rack { }; - vdirsyncer = callPackage ../tools/misc/vdirsyncer { - inherit (darwin.apple_sdk.frameworks) CoreServices Security; - }; + vdirsyncer = with python3Packages; toPythonApplication vdirsyncer; - vdirsyncerStable = callPackage ../tools/misc/vdirsyncer/stable.nix { }; + vdirsyncerStable = with python3Packages; toPythonApplication vdirsyncerStable; vdpauinfo = callPackage ../tools/X11/vdpauinfo { }; diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 513b5876bf0f..c7c14cc95cf7 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -1607,6 +1607,13 @@ in { vdf = callPackage ../development/python-modules/vdf { }; + vdirsyncer = callPackage ../development/python-modules/vdirsyncer { + inherit (pkgs.darwin.apple_sdk.frameworks) CoreServices Security; + inherit (pkgs) pkg-config openssl rustPlatform; + }; + + vdirsyncerStable = callPackage ../development/python-modules/vdirsyncer/stable.nix { }; + vidstab = callPackage ../development/python-modules/vidstab { }; webapp2 = callPackage ../development/python-modules/webapp2 { };