From 664d9fa7e39ae6827153051552b0e755f7a2d2a0 Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Sat, 24 Feb 2024 14:20:34 +0100 Subject: [PATCH 1/5] python311Packages.cherrypy: refactor --- .../python-modules/cherrypy/default.nix | 33 ++++++++++++------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/pkgs/development/python-modules/cherrypy/default.nix b/pkgs/development/python-modules/cherrypy/default.nix index 51c8b62c9716..c653533f60d3 100644 --- a/pkgs/development/python-modules/cherrypy/default.nix +++ b/pkgs/development/python-modules/cherrypy/default.nix @@ -17,6 +17,7 @@ , pythonOlder , requests-toolbelt , routes +, setuptools , setuptools-scm , simplejson , zc-lockfile @@ -25,7 +26,7 @@ buildPythonPackage rec { pname = "cherrypy"; version = "18.8.0"; - format = "setuptools"; + pyproject = true; disabled = pythonOlder "3.7"; @@ -38,22 +39,23 @@ buildPythonPackage rec { postPatch = '' # Disable doctest plugin because times out substituteInPlace pytest.ini \ - --replace "--doctest-modules" "-vvv" \ - --replace "-p pytest_cov" "" \ - --replace "--no-cov-on-fail" "" + --replace-fail "--doctest-modules" "-vvv" \ + --replace-fail "-p pytest_cov" "" \ + --replace-fail "--no-cov-on-fail" "" sed -i "/--cov/d" pytest.ini ''; nativeBuildInputs = [ + setuptools setuptools-scm ]; propagatedBuildInputs = [ cheroot - portend - more-itertools - zc-lockfile jaraco-collections + more-itertools + portend + zc-lockfile ]; nativeCheckInputs = [ @@ -115,10 +117,18 @@ buildPythonPackage rec { ]; passthru.optional-dependencies = { - json = [ simplejson ]; - memcached_session = [ python-memcached ]; - routes_dispatcher = [ routes ]; - ssl = [ pyopenssl ]; + json = [ + simplejson + ]; + memcached_session = [ + python-memcached + ]; + routes_dispatcher = [ + routes + ]; + ssl = [ + pyopenssl + ]; # not packaged yet xcgi = [ /* flup */ ]; }; @@ -126,6 +136,7 @@ buildPythonPackage rec { meta = with lib; { description = "Object-oriented HTTP framework"; homepage = "https://cherrypy.dev/"; + changelog = "https://github.com/cherrypy/cherrypy/blob/v${version}/CHANGES.rst"; license = licenses.bsd3; maintainers = with maintainers; [ ]; }; From 3a56a640c83227a94a5b3c2b0b33ffde3e3fafa6 Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Sat, 24 Feb 2024 14:27:28 +0100 Subject: [PATCH 2/5] python311Packages.cherrypy: 18.8.0 -> 18.9.0 Changelog: https://github.com/cherrypy/cherrypy/blob/v18.9.0/CHANGES.rst --- pkgs/development/python-modules/cherrypy/default.nix | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pkgs/development/python-modules/cherrypy/default.nix b/pkgs/development/python-modules/cherrypy/default.nix index c653533f60d3..d68fcf565984 100644 --- a/pkgs/development/python-modules/cherrypy/default.nix +++ b/pkgs/development/python-modules/cherrypy/default.nix @@ -25,7 +25,7 @@ buildPythonPackage rec { pname = "cherrypy"; - version = "18.8.0"; + version = "18.9.0"; pyproject = true; disabled = pythonOlder "3.7"; @@ -33,10 +33,12 @@ buildPythonPackage rec { src = fetchPypi { pname = "CherryPy"; inherit version; - hash = "sha256-m0jPuoovFtW2QZzGV+bVHbAFujXF44JORyi7A7vH75s="; + hash = "sha256-awbBkc5xqGRh8wVyoatX/8CfQxQ7qOQsEDx7M0ciDrE="; }; postPatch = '' + substituteInPlace pyproject.toml \ + --replace-fail '"setuptools_scm_git_archive >= 1.1",' "" # Disable doctest plugin because times out substituteInPlace pytest.ini \ --replace-fail "--doctest-modules" "-vvv" \ From e3c9737564ada3069beefe5cb841055eb7132b8c Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Sat, 24 Feb 2024 15:40:54 +0100 Subject: [PATCH 3/5] python311Packages.cherrypy: add patch to remove distutils --- pkgs/development/python-modules/cherrypy/default.nix | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pkgs/development/python-modules/cherrypy/default.nix b/pkgs/development/python-modules/cherrypy/default.nix index d68fcf565984..c34195f6c685 100644 --- a/pkgs/development/python-modules/cherrypy/default.nix +++ b/pkgs/development/python-modules/cherrypy/default.nix @@ -2,6 +2,7 @@ , stdenv , buildPythonPackage , cheroot +, fetchpatch , fetchPypi , jaraco-collections , more-itertools @@ -36,6 +37,15 @@ buildPythonPackage rec { hash = "sha256-awbBkc5xqGRh8wVyoatX/8CfQxQ7qOQsEDx7M0ciDrE="; }; + patches = [ + # Replace distutils.spawn.find_executable with shutil.which, https://github.com/cherrypy/cherrypy/pull/2023 + (fetchpatch { + name = "remove-distutils.patch"; + url = "https://github.com/cherrypy/cherrypy/commit/8a19dd5f1e712a326a3613b17e6fc900012ed09a.patch"; + hash = "sha256-fXECX0CdU74usiq9GEkIG9CF+dueszblT4qOeF6B700="; + }) + ]; + postPatch = '' substituteInPlace pyproject.toml \ --replace-fail '"setuptools_scm_git_archive >= 1.1",' "" From e506017eaf7d3eab5bbd7aa09ed845d5f51de08d Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Mon, 26 Feb 2024 18:10:08 +0100 Subject: [PATCH 4/5] python311Packages.pytest-services: refactor - enable tests --- .../pytest-services/default.nix | 41 ++++++++++++++----- 1 file changed, 31 insertions(+), 10 deletions(-) diff --git a/pkgs/development/python-modules/pytest-services/default.nix b/pkgs/development/python-modules/pytest-services/default.nix index 91094c81ab41..10913f94924c 100644 --- a/pkgs/development/python-modules/pytest-services/default.nix +++ b/pkgs/development/python-modules/pytest-services/default.nix @@ -1,23 +1,31 @@ { lib , buildPythonPackage -, fetchPypi -, isPy3k -, requests +, fetchFromGitHub , psutil +, pylibmc , pytest +, pytestCheckHook +, pythonOlder +, requests +, setuptools , setuptools-scm , toml +, mysqlclient , zc-lockfile }: buildPythonPackage rec { pname = "pytest-services"; version = "2.2.1"; - format = "setuptools"; + pyproject = true; - src = fetchPypi { - inherit pname version; - sha256 = "2da740487d08ea63dfdf718f5d4ba11e590c99ddf5481549edebf7a3a42ca536"; + disabled = pythonOlder "3.7"; + + src = fetchFromGitHub { + owner = "pytest-dev"; + repo = "pytest-services"; + rev = "refs/tags/${version}"; + hash = "sha256-E/VcKcAb1ekypm5jP4lsSz1LYJTcTSed6i5OY5ihP30="; }; nativeBuildInputs = [ @@ -33,14 +41,27 @@ buildPythonPackage rec { zc-lockfile ]; - # no tests in PyPI tarball - doCheck = false; + nativeCheckInputs = [ + mysqlclient + pylibmc + pytestCheckHook + ]; - pythonImportsCheck = [ "pytest_services" ]; + pythonImportsCheck = [ + "pytest_services" + ]; + + disabledTests = [ + # Tests require binaries and additional parts + "test_memcached" + "test_mysql" + "test_xvfb " + ]; meta = with lib; { description = "Services plugin for pytest testing framework"; homepage = "https://github.com/pytest-dev/pytest-services"; + changelog = "https://github.com/pytest-dev/pytest-services/blob/${version}/CHANGES.rst"; license = licenses.mit; maintainers = with maintainers; [ dotlambda ]; }; From e16e8bbfe9403d6ddbe210023b1fc253341bae33 Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Mon, 26 Feb 2024 18:25:01 +0100 Subject: [PATCH 5/5] python312Packages.pytest-services: add patch to relace distutils --- .../python-modules/cherrypy/default.nix | 18 ++++-------------- .../python-modules/pytest-services/default.nix | 10 ++++++++++ 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/pkgs/development/python-modules/cherrypy/default.nix b/pkgs/development/python-modules/cherrypy/default.nix index c34195f6c685..903be65bf068 100644 --- a/pkgs/development/python-modules/cherrypy/default.nix +++ b/pkgs/development/python-modules/cherrypy/default.nix @@ -18,7 +18,6 @@ , pythonOlder , requests-toolbelt , routes -, setuptools , setuptools-scm , simplejson , zc-lockfile @@ -58,7 +57,6 @@ buildPythonPackage rec { ''; nativeBuildInputs = [ - setuptools setuptools-scm ]; @@ -129,18 +127,10 @@ buildPythonPackage rec { ]; passthru.optional-dependencies = { - json = [ - simplejson - ]; - memcached_session = [ - python-memcached - ]; - routes_dispatcher = [ - routes - ]; - ssl = [ - pyopenssl - ]; + json = [ simplejson ]; + memcached_session = [ python-memcached ]; + routes_dispatcher = [ routes ]; + ssl = [ pyopenssl ]; # not packaged yet xcgi = [ /* flup */ ]; }; diff --git a/pkgs/development/python-modules/pytest-services/default.nix b/pkgs/development/python-modules/pytest-services/default.nix index 10913f94924c..0b6a8f8f87b5 100644 --- a/pkgs/development/python-modules/pytest-services/default.nix +++ b/pkgs/development/python-modules/pytest-services/default.nix @@ -1,6 +1,7 @@ { lib , buildPythonPackage , fetchFromGitHub +, fetchpatch , psutil , pylibmc , pytest @@ -28,6 +29,15 @@ buildPythonPackage rec { hash = "sha256-E/VcKcAb1ekypm5jP4lsSz1LYJTcTSed6i5OY5ihP30="; }; + patches = [ + # Replace distutils.spawn.find_executable with shutil.which, https://github.com/pytest-dev/pytest-services/pull/46 + (fetchpatch { + name = "replace-distutils.patch"; + url = "https://github.com/pytest-dev/pytest-services/commit/e0e2a85434a2dcbcc0584299c5b2b751efe0b6db.patch"; + hash = "sha256-hvr7EedfjfonHDn6v2slwUBqz1xQoF7Ez/kqAhZRXEc="; + }) + ]; + nativeBuildInputs = [ setuptools-scm toml