From 433db3a30c5f779c4abe5a72a62595ca0af2d520 Mon Sep 17 00:00:00 2001 From: Martin Weinelt Date: Sat, 20 Jun 2020 17:08:33 +0200 Subject: [PATCH] pinnwand: 1.1.2 -> 1.2.0 Build the package from Git using pyproject.toml and enable tests. --- pkgs/servers/pinnwand/add-build-backend.patch | 12 +++++++++ pkgs/servers/pinnwand/default.nix | 27 ++++++++++++++----- 2 files changed, 32 insertions(+), 7 deletions(-) create mode 100644 pkgs/servers/pinnwand/add-build-backend.patch diff --git a/pkgs/servers/pinnwand/add-build-backend.patch b/pkgs/servers/pinnwand/add-build-backend.patch new file mode 100644 index 00000000000..2236cb5fc08 --- /dev/null +++ b/pkgs/servers/pinnwand/add-build-backend.patch @@ -0,0 +1,12 @@ +diff --git a/pyproject.toml b/pyproject.toml +index 3c4e87e..af27304 100644 +--- a/pyproject.toml ++++ b/pyproject.toml +@@ -58,5 +58,6 @@ exclude = ''' + pinnwand = 'pinnwand.__main__:main' + + [build-system] +-requires = ["setuptools", "wheel"] ++requires = ["poetry>=0.12"] ++build-backend = "poetry.masonry.api" + diff --git a/pkgs/servers/pinnwand/default.nix b/pkgs/servers/pinnwand/default.nix index 436a599b17e..6c80ba82a11 100644 --- a/pkgs/servers/pinnwand/default.nix +++ b/pkgs/servers/pinnwand/default.nix @@ -1,4 +1,4 @@ -{ lib, python3, fetchFromGitHub, nixosTests }: +{ lib, python3, fetchFromGitHub, poetry, nixosTests }: let python = python3.override { @@ -14,13 +14,25 @@ let }; in with python.pkgs; buildPythonApplication rec { pname = "pinnwand"; - version = "1.1.2"; + version = "1.2.0"; + format = "pyproject"; - src = fetchPypi { - inherit pname version; - sha256 = "0iincxkfyyx85ggx9ilms2f8aq4lcbg3rkqgrr4wlsflzhljqd0p"; + src = fetchFromGitHub { + owner = "supakeen"; + repo = pname; + rev = "v${version}"; + sha256 = "n5PH21QmU8YAb0WKXAKZR4wjfFTSSOtvlRq7yxRVZNE="; }; + patches = [ + # https://github.com/supakeen/pinnwand/issues/93 + ./add-build-backend.patch + ]; + + nativeBuildInputs = [ + poetry + ]; + propagatedBuildInputs = [ click docutils @@ -30,9 +42,10 @@ in with python.pkgs; buildPythonApplication rec { sqlalchemy ]; - # tests are only available when fetching from GitHub, where they in turn don't have a setup.py :( + checkInputs = [ pytest ]; + checkPhase = '' - $out/bin/pinnwand --help > /dev/null + pytest ''; passthru.tests = nixosTests.pinnwand;