summary refs log tree commit diff
diff options
context:
space:
mode:
authorDoron Behar <doron.behar@gmail.com>2020-05-17 11:19:40 +0300
committerGitHub <noreply@github.com>2020-05-17 10:19:40 +0200
commitb3e7e67a5e7fe812fed3fe3b83d22fa853eda2a4 (patch)
tree8205cf329f2cb755ed7f0c763f71c73a197f058b
parent6c195563e1fdaa005f448caeb976cb249f838a7d (diff)
downloadnixpkgs-b3e7e67a5e7fe812fed3fe3b83d22fa853eda2a4.tar
nixpkgs-b3e7e67a5e7fe812fed3fe3b83d22fa853eda2a4.tar.gz
nixpkgs-b3e7e67a5e7fe812fed3fe3b83d22fa853eda2a4.tar.bz2
nixpkgs-b3e7e67a5e7fe812fed3fe3b83d22fa853eda2a4.tar.lz
nixpkgs-b3e7e67a5e7fe812fed3fe3b83d22fa853eda2a4.tar.xz
nixpkgs-b3e7e67a5e7fe812fed3fe3b83d22fa853eda2a4.tar.zst
nixpkgs-b3e7e67a5e7fe812fed3fe3b83d22fa853eda2a4.zip
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
-rw-r--r--pkgs/development/python-modules/vdirsyncer/default.nix (renamed from pkgs/tools/misc/vdirsyncer/default.nix)44
-rw-r--r--pkgs/development/python-modules/vdirsyncer/stable.nix (renamed from pkgs/tools/misc/vdirsyncer/stable.nix)50
-rw-r--r--pkgs/top-level/all-packages.nix6
-rw-r--r--pkgs/top-level/python-packages.nix7
4 files changed, 90 insertions, 17 deletions
diff --git a/pkgs/tools/misc/vdirsyncer/default.nix b/pkgs/development/python-modules/vdirsyncer/default.nix
index 61c9b9df877..1a5494634bb 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
index ada70678e34..cb90bfbc598 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 7e32522158c..fc8f53db0ad 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 513b5876bf0..c7c14cc95cf 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 { };