From 6d93fcda5b5ebd53ae0ffb05a97ce167f3f13a9b Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Fri, 19 May 2023 09:40:12 +0200 Subject: [PATCH] python310Packages.polyline: modernize - switch to pytestCheckHook - add format and changelog - disable on unsupported Python releases - add pythonImportsCheck --- .../python-modules/polyline/default.nix | 48 +++++++++++++------ 1 file changed, 34 insertions(+), 14 deletions(-) diff --git a/pkgs/development/python-modules/polyline/default.nix b/pkgs/development/python-modules/polyline/default.nix index 37bc3bc2e1b..26cec2331cb 100644 --- a/pkgs/development/python-modules/polyline/default.nix +++ b/pkgs/development/python-modules/polyline/default.nix @@ -1,31 +1,51 @@ { lib , buildPythonPackage -, fetchPypi -, six -, flake8 -, nose +, fetchFromGitHub +, pytestCheckHook +, pythonOlder +, setuptools }: buildPythonPackage rec { pname = "polyline"; version = "2.0.0"; + format = "pyproject"; - src = fetchPypi { - inherit pname version; - hash = "sha256-FJK4/K3CFD+K7cZz08bZXfRRMfHGLrjVHIGDsk53FIY="; + disabled = pythonOlder "3.7"; + + src = fetchFromGitHub { + owner = "frederickjansen"; + repo = pname; + rev = "refs/tags/${version}"; + hash = "sha256-e9ZDqcS3MaMlXi2a2JHI6NtRPqIV7rjsucGXEH6V8LA="; }; - propagatedBuildInputs = [ six ]; - nativeCheckInputs = [ flake8 nose ]; - checkPhase = '' - nosetests + postPatch = '' + substituteInPlace pyproject.toml \ + --replace " --cov=polyline --cov-report term-missing" "" ''; + nativeBuildInputs = [ + setuptools + ]; + + nativeCheckInputs = [ + pytestCheckHook + ]; + + pythonImportsCheck = [ + "polyline" + ]; + meta = with lib; { - homepage = "https://github.com/hicsail/polyline"; + description = "Python implementation of Google's Encoded Polyline Algorithm Format"; + longDescription = '' + polyline is a Python implementation of Google's Encoded Polyline Algorithm Format. It is + essentially a port of https://github.com/mapbox/polyline. + ''; + homepage = "https://github.com/frederickjansen/polyline"; + changelog = "https://github.com/frederickjansen/polyline/releases/tag/${version}"; license = licenses.mit; - description = "Python implementation of Google's Encoded Polyline Algorithm Format."; - longDescription = "polyline is a Python implementation of Google's Encoded Polyline Algorithm Format (http://goo.gl/PvXf8Y). It is essentially a port of https://github.com/mapbox/polyline built with Python 2 and 3 support in mind."; maintainers = with maintainers; [ ersin ]; }; }