From e71892d14ab976146fd87b26a88d19fec840db9b Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Thu, 10 Aug 2023 12:29:38 +0200 Subject: [PATCH 1/3] python311Packages.scrapy-fake-useragent: disable failing test - remove coverage - disable on unsupported Python releases - add format --- .../scrapy-fake-useragent/default.nix | 38 +++++++++++++++++-- 1 file changed, 34 insertions(+), 4 deletions(-) diff --git a/pkgs/development/python-modules/scrapy-fake-useragent/default.nix b/pkgs/development/python-modules/scrapy-fake-useragent/default.nix index c8a909691f94..f81655eca87e 100644 --- a/pkgs/development/python-modules/scrapy-fake-useragent/default.nix +++ b/pkgs/development/python-modules/scrapy-fake-useragent/default.nix @@ -1,24 +1,54 @@ -{ lib, fetchFromGitHub, buildPythonPackage, pytestCheckHook, pytest-cov, pytest-mock, fake-useragent, faker, scrapy }: +{ lib +, buildPythonPackage +, fake-useragent +, faker +, fetchFromGitHub +, pytest-mock +, pytestCheckHook +, pythonOlder +, scrapy +}: buildPythonPackage rec { pname = "scrapy-fake-useragent"; version = "1.4.4"; + format = "setuptools"; + + disabled = pythonOlder "3.7"; # PyPi tarball is corrupted src = fetchFromGitHub { owner = "alecxe"; repo = pname; rev = "59c20d38c58c76618164760d546aa5b989a79b8b"; # no tags - sha256 = "0yb7d51jws665rdfqkmi077w0pjxmb2ni7ysphj7lx7b18whq54j"; + hash = "sha256-khQMOQrrdHokvNqfaMWqXV7AzwGxTuxaLsZoLkNpZ3k="; }; - propagatedBuildInputs = [ fake-useragent faker ]; + postPatch = '' + substituteInPlace pytest.ini \ + --replace " --cov=scrapy_fake_useragent --cov-report=term --cov-report=html --fulltrace" "" + ''; - nativeCheckInputs = [ pytestCheckHook scrapy pytest-cov pytest-mock ]; + propagatedBuildInputs = [ + fake-useragent + faker + ]; + + nativeCheckInputs = [ + pytest-mock + pytestCheckHook + scrapy + ]; + + disabledTests = [ + # AttributeError: 'RetryUserAgentMiddleware' object has no attribute 'EXCEPTIONS_TO_RETRY' + "test_random_ua_set_on_exception" + ]; meta = with lib; { description = "Random User-Agent middleware based on fake-useragent"; homepage = "https://github.com/alecxe/scrapy-fake-useragent"; license = licenses.mit; + maintainers = with maintainers; [ ]; }; } From 3f7b93f14c4a8eebf09b14324ab1e5282fe2bacc Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Thu, 10 Aug 2023 12:30:52 +0200 Subject: [PATCH 2/3] python311Packages.scrapy-fake-useragent: add pythonImportsCheck --- .../python-modules/scrapy-fake-useragent/default.nix | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkgs/development/python-modules/scrapy-fake-useragent/default.nix b/pkgs/development/python-modules/scrapy-fake-useragent/default.nix index f81655eca87e..e707981a8ccc 100644 --- a/pkgs/development/python-modules/scrapy-fake-useragent/default.nix +++ b/pkgs/development/python-modules/scrapy-fake-useragent/default.nix @@ -40,6 +40,10 @@ buildPythonPackage rec { scrapy ]; + pythonImportsCheck = [ + "scrapy_fake_useragent" + ]; + disabledTests = [ # AttributeError: 'RetryUserAgentMiddleware' object has no attribute 'EXCEPTIONS_TO_RETRY' "test_random_ua_set_on_exception" From 96199e2949af0e16b68437670c1dbbb693fbf650 Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Thu, 10 Aug 2023 12:31:48 +0200 Subject: [PATCH 3/3] python311Packages.scrapy-fake-useragent: add changelog to meta --- .../development/python-modules/scrapy-fake-useragent/default.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/pkgs/development/python-modules/scrapy-fake-useragent/default.nix b/pkgs/development/python-modules/scrapy-fake-useragent/default.nix index e707981a8ccc..f4474235cd23 100644 --- a/pkgs/development/python-modules/scrapy-fake-useragent/default.nix +++ b/pkgs/development/python-modules/scrapy-fake-useragent/default.nix @@ -52,6 +52,7 @@ buildPythonPackage rec { meta = with lib; { description = "Random User-Agent middleware based on fake-useragent"; homepage = "https://github.com/alecxe/scrapy-fake-useragent"; + changelog = "https://github.com/alecxe/scrapy-fake-useragent/blob/master/CHANGELOG.rst"; license = licenses.mit; maintainers = with maintainers; [ ]; };