From d584164d24ebe8caa1cf6d753f7c55765e4ec680 Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Mon, 14 Feb 2022 12:01:25 +0100 Subject: [PATCH 1/4] python3Packages.aiohttp-apispec: move to python-modules --- .../p2p/tribler/aiohttp-apispec.nix | 37 --------------- .../aiohttp-apispec/default.nix | 45 +++++++++++++++++++ pkgs/top-level/python-packages.nix | 2 + 3 files changed, 47 insertions(+), 37 deletions(-) delete mode 100644 pkgs/applications/networking/p2p/tribler/aiohttp-apispec.nix create mode 100644 pkgs/development/python-modules/aiohttp-apispec/default.nix diff --git a/pkgs/applications/networking/p2p/tribler/aiohttp-apispec.nix b/pkgs/applications/networking/p2p/tribler/aiohttp-apispec.nix deleted file mode 100644 index 4e1f5ee6ca70..000000000000 --- a/pkgs/applications/networking/p2p/tribler/aiohttp-apispec.nix +++ /dev/null @@ -1,37 +0,0 @@ -{ lib, buildPythonPackage, fetchPypi, pythonOlder -, aiohttp, webargs, fetchFromGitHub, callPackage -}: - -let - apispec3 = callPackage ./apispec.nix {}; - jinja2 = callPackage ../../../../development/python2-modules/jinja2 {}; -in -buildPythonPackage rec { - pname = "aiohttp-apispec"; - version = "unstable-2021-21-08"; - - # unstable so we can use latest webargs - src = fetchFromGitHub { - owner = "maximdanilchenko"; - repo = "aiohttp-apispec"; - rev = "cfa19646394480dda289f6b7af19b7d50f245d81"; - sha256 = "uEgDRAlMjTa4rvdE3fkORCHIlCLzxPJJ2/m4ZRU3eIQ="; - fetchSubmodules = false; - }; - - propagatedBuildInputs = [ aiohttp webargs apispec3 jinja2 ]; - - pythonImportsCheck = [ - "aiohttp_apispec" - ]; - - # Requires pytest-sanic, currently broken in nixpkgs - doCheck = false; - - meta = with lib; { - description = "Build and document REST APIs with aiohttp and apispec"; - homepage = "https://github.com/maximdanilchenko/aiohttp-apispec/"; - license = licenses.mit; - maintainers = [ maintainers.viric ]; - }; -} diff --git a/pkgs/development/python-modules/aiohttp-apispec/default.nix b/pkgs/development/python-modules/aiohttp-apispec/default.nix new file mode 100644 index 000000000000..b5547cb8a121 --- /dev/null +++ b/pkgs/development/python-modules/aiohttp-apispec/default.nix @@ -0,0 +1,45 @@ +{ lib +, aiohttp +, buildPythonPackage +, callPackage +, fetchFromGitHub +, fetchPypi +, pythonOlder +, webargs +}: + +buildPythonPackage rec { + pname = "aiohttp-apispec"; + version = "2.2.2"; + format = "setuptools"; + + disabled = pythonOlder "3.6"; + + src = fetchFromGitHub { + owner = "maximdanilchenko"; + repo = pname; + rev = "v${version}"; + hash = "sha256-51QyD56k+1fq2tOqBNUtPRFza9uku79GcvTh8wov04g="; + }; + + propagatedBuildInputs = [ + aiohttp + apispec3 + jinja2 + webargs + ]; + + pythonImportsCheck = [ + "aiohttp_apispec" + ]; + + # Requires pytest-sanic, currently broken in nixpkgs + doCheck = false; + + meta = with lib; { + description = "Build and document REST APIs with aiohttp and apispec"; + homepage = "https://github.com/maximdanilchenko/aiohttp-apispec/"; + license = licenses.mit; + maintainers = with maintainers; [ viric ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 09e150fc6717..604f4386ec38 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -308,6 +308,8 @@ in { aiohttp = callPackage ../development/python-modules/aiohttp { }; + aiohttp-apispec = callPackage ../development/python-modules/aiohttp-apispec { }; + aiohttp-cors = callPackage ../development/python-modules/aiohttp-cors { }; aiohttp-jinja2 = callPackage ../development/python-modules/aiohttp-jinja2 { }; From e0f783ca387bddfdddc3340eb3503df4da9fb10e Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Mon, 14 Feb 2022 12:44:36 +0100 Subject: [PATCH 2/4] python3Packages.aiohttp-apispec: 2.2.2 -> 3.0.0b1 --- .../python-modules/aiohttp-apispec/default.nix | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/pkgs/development/python-modules/aiohttp-apispec/default.nix b/pkgs/development/python-modules/aiohttp-apispec/default.nix index b5547cb8a121..b0184c294c27 100644 --- a/pkgs/development/python-modules/aiohttp-apispec/default.nix +++ b/pkgs/development/python-modules/aiohttp-apispec/default.nix @@ -1,16 +1,19 @@ { lib , aiohttp +, apispec , buildPythonPackage , callPackage , fetchFromGitHub , fetchPypi +, jinja2 +, packaging , pythonOlder , webargs }: buildPythonPackage rec { pname = "aiohttp-apispec"; - version = "2.2.2"; + version = "3.0.0b1"; format = "setuptools"; disabled = pythonOlder "3.6"; @@ -19,16 +22,22 @@ buildPythonPackage rec { owner = "maximdanilchenko"; repo = pname; rev = "v${version}"; - hash = "sha256-51QyD56k+1fq2tOqBNUtPRFza9uku79GcvTh8wov04g="; + hash = "sha256-LGdi5ZhJ1G0GxUJVBZnwW3Q+x3Yo9FRV9b6REPlq7As="; }; propagatedBuildInputs = [ aiohttp - apispec3 + apispec jinja2 + packaging webargs ]; + postPatch = '' + substituteInPlace requirements.txt \ + --replace "jinja2<3.0" "jinja2" + ''; + pythonImportsCheck = [ "aiohttp_apispec" ]; From 3bbd6325b21ac33fa2c93ea31eef6b1f1ffed792 Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Mon, 14 Feb 2022 12:47:22 +0100 Subject: [PATCH 3/4] python3Packages.aiohttp-apispec: enable tests --- .../python-modules/aiohttp-apispec/default.nix | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/pkgs/development/python-modules/aiohttp-apispec/default.nix b/pkgs/development/python-modules/aiohttp-apispec/default.nix index b0184c294c27..ffd8e698c58e 100644 --- a/pkgs/development/python-modules/aiohttp-apispec/default.nix +++ b/pkgs/development/python-modules/aiohttp-apispec/default.nix @@ -7,6 +7,8 @@ , fetchPypi , jinja2 , packaging +, pytest-aiohttp +, pytestCheckHook , pythonOlder , webargs }: @@ -33,6 +35,11 @@ buildPythonPackage rec { webargs ]; + checkInputs = [ + pytest-aiohttp + pytestCheckHook + ]; + postPatch = '' substituteInPlace requirements.txt \ --replace "jinja2<3.0" "jinja2" @@ -42,9 +49,6 @@ buildPythonPackage rec { "aiohttp_apispec" ]; - # Requires pytest-sanic, currently broken in nixpkgs - doCheck = false; - meta = with lib; { description = "Build and document REST APIs with aiohttp and apispec"; homepage = "https://github.com/maximdanilchenko/aiohttp-apispec/"; From 6160b005e007aac8a06ee425d6d7c98427758e51 Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Mon, 14 Feb 2022 13:05:34 +0100 Subject: [PATCH 4/4] tribler: remove local apispec --- .../networking/p2p/tribler/apispec.nix | 47 ------------ .../networking/p2p/tribler/default.nix | 71 +++++++++---------- 2 files changed, 35 insertions(+), 83 deletions(-) delete mode 100644 pkgs/applications/networking/p2p/tribler/apispec.nix diff --git a/pkgs/applications/networking/p2p/tribler/apispec.nix b/pkgs/applications/networking/p2p/tribler/apispec.nix deleted file mode 100644 index e60a440df3f4..000000000000 --- a/pkgs/applications/networking/p2p/tribler/apispec.nix +++ /dev/null @@ -1,47 +0,0 @@ -{ lib -, buildPythonPackage -, fetchPypi -, pyyaml -, prance -, marshmallow -, pytestCheckHook -, mock -, openapi-spec-validator -}: - -buildPythonPackage rec { - pname = "apispec"; - version = "3.3.2"; - - src = fetchPypi { - inherit pname version; - sha256 = "d23ebd5b71e541e031b02a19db10b5e6d5ef8452c552833e3e1afc836b40b1ad"; - }; - - propagatedBuildInputs = [ - pyyaml - prance - ]; - - postPatch = '' - rm tests/test_ext_marshmallow.py - ''; - - checkInputs = [ - openapi-spec-validator - marshmallow - mock - pytestCheckHook - ]; - - pythonImportsCheck = [ - "apispec" - ]; - - meta = with lib; { - description = "A pluggable API specification generator. Currently supports the OpenAPI Specification (f.k.a. the Swagger specification"; - homepage = "https://github.com/marshmallow-code/apispec"; - license = licenses.mit; - maintainers = [ maintainers.viric ]; - }; -} diff --git a/pkgs/applications/networking/p2p/tribler/default.nix b/pkgs/applications/networking/p2p/tribler/default.nix index 6a8f93a29381..38fc90d8e589 100644 --- a/pkgs/applications/networking/p2p/tribler/default.nix +++ b/pkgs/applications/networking/p2p/tribler/default.nix @@ -1,12 +1,15 @@ -{ stdenv, lib, fetchurl, python3, makeWrapper -, libtorrent-rasterbar-1_2_x, qt5 +{ lib +, stdenv +, fetchurl +, python3 +, makeWrapper +, libtorrent-rasterbar-1_2_x +, qt5 }: let libtorrent = (python3.pkgs.toPythonModule ( libtorrent-rasterbar-1_2_x.override { python = python3; })).python; - - aiohttp-apispec = python3.pkgs.callPackage ./aiohttp-apispec.nix { }; in stdenv.mkDerivation rec { pname = "tribler"; @@ -14,7 +17,7 @@ stdenv.mkDerivation rec { src = fetchurl { url = "https://github.com/Tribler/tribler/releases/download/v${version}/Tribler-v${version}.tar.xz"; - sha256 = "1x45z23d1cqf0lai7wg5ki7gi2vba5hqk0swhggzplcjwma4wmh9"; + hash = "sha256-CVZOVOWS0fvfg1yDiWFRa4v4Tpzl8RMVBQ6z0Ib4hfQ="; }; nativeBuildInputs = [ @@ -29,40 +32,36 @@ stdenv.mkDerivation rec { pythonPath = [ libtorrent ] ++ (with python3.pkgs; [ - twisted - netifaces - pycrypto - pyasn1 - requests - m2crypto - pyqt5 - chardet - cherrypy - cryptography - libnacl - configobj - decorator - feedparser - service-identity - psutil - pillow - networkx - pony - lz4 - pyqtgraph - pyyaml aiohttp aiohttp-apispec + asynctest + chardet + cherrypy + configobj + cryptography + decorator faker - sentry-sdk + feedparser + libnacl + lz4 + m2crypto + netifaces + networkx + pillow + pony + psutil + pyasn1 + pycrypto + pyqt5 + pyqtgraph pytest-asyncio pytest-timeout - asynctest + pyyaml + requests + sentry-sdk + service-identity + twisted yappi - - # there is a BTC feature, but it requires some unclear version of - # bitcoinlib, so this doesn't work right now. - # bitcoinlib ]); installPhase = '' @@ -84,10 +83,10 @@ stdenv.mkDerivation rec { ''; meta = with lib; { - maintainers = with maintainers; [ xvapx viric ]; + description = "Decentralised P2P filesharing client based on the Bittorrent protocol"; homepage = "https://www.tribler.org/"; - description = "A completely decentralised P2P filesharing client based on the Bittorrent protocol"; - license = licenses.lgpl21; + license = licenses.lgpl21Plus; + maintainers = with maintainers; [ xvapx viric ]; platforms = platforms.linux; }; }