From 2d083acf666f7f7c7a4ca6e5c665207aa58d1ba2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Llu=C3=ADs=20Batlle=20i=20Rossell?= Date: Wed, 24 Nov 2021 17:40:40 +0100 Subject: [PATCH] tribler: 7.4.4 -> 7.10.0 This also adds old versions of apispec and webargs that tribler requires, and aiohttp-apispec as well. --- .../networking/p2p/tribler/default.nix | 66 ++++++++++--------- .../aiohttp-apispec/unstable.nix | 37 +++++++++++ pkgs/development/python-modules/apispec/3.nix | 47 +++++++++++++ pkgs/development/python-modules/jinja2/2.nix | 2 +- .../python-modules/webargs/default.nix | 2 +- pkgs/top-level/python-packages.nix | 4 +- 6 files changed, 123 insertions(+), 35 deletions(-) create mode 100644 pkgs/development/python-modules/aiohttp-apispec/unstable.nix create mode 100644 pkgs/development/python-modules/apispec/3.nix diff --git a/pkgs/applications/networking/p2p/tribler/default.nix b/pkgs/applications/networking/p2p/tribler/default.nix index 3aa5b4a8da82..774aea642d43 100644 --- a/pkgs/applications/networking/p2p/tribler/default.nix +++ b/pkgs/applications/networking/p2p/tribler/default.nix @@ -1,26 +1,35 @@ -{ stdenv, fetchurl, python3Packages, makeWrapper -, enablePlayer ? true, libvlc, qt5, lib }: +{ stdenv, lib, 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 + ../../../../development/python-modules/aiohttp-apispec/unstable.nix { }; +in stdenv.mkDerivation rec { pname = "tribler"; - version = "7.4.4"; + version = "7.10.0"; src = fetchurl { url = "https://github.com/Tribler/tribler/releases/download/v${version}/Tribler-v${version}.tar.xz"; - sha256 = "0hxiyf1k07ngym2p8r1b5mcx1y2crkyz43gi9sgvsvsyijyaff3p"; + sha256 = "1x45z23d1cqf0lai7wg5ki7gi2vba5hqk0swhggzplcjwma4wmh9"; }; nativeBuildInputs = [ - python3Packages.wrapPython + python3.pkgs.wrapPython makeWrapper ]; buildInputs = [ - python3Packages.python + python3.pkgs.python ]; - pythonPath = with python3Packages; [ - libtorrent-rasterbar + pythonPath = [ + libtorrent + ] ++ (with python3.pkgs; [ twisted netifaces pycrypto @@ -42,49 +51,44 @@ stdenv.mkDerivation rec { pony lz4 pyqtgraph + pyyaml + aiohttp + aiohttp-apispec + faker + sentry-sdk + pytest-asyncio + pytest-timeout + asynctest + yappi # there is a BTC feature, but it requires some unclear version of # bitcoinlib, so this doesn't work right now. # bitcoinlib - ]; - - postPatch = '' - ${lib.optionalString enablePlayer '' - substituteInPlace "./TriblerGUI/vlc.py" --replace "ctypes.CDLL(p)" "ctypes.CDLL('${libvlc}/lib/libvlc.so')" - substituteInPlace "./TriblerGUI/widgets/videoplayerpage.py" \ - --replace "if vlc and vlc.plugin_path" "if vlc" \ - --replace "os.environ['VLC_PLUGIN_PATH'] = vlc.plugin_path" "os.environ['VLC_PLUGIN_PATH'] = '${libvlc}/lib/vlc/plugins'" - ''} - ''; + ]); installPhase = '' mkdir -pv $out # Nasty hack; call wrapPythonPrograms to set program_PYTHONPATH. wrapPythonPrograms cp -prvd ./* $out/ - makeWrapper ${python3Packages.python}/bin/python $out/bin/tribler \ + makeWrapper ${python3.pkgs.python}/bin/python $out/bin/tribler \ --set QT_QPA_PLATFORM_PLUGIN_PATH ${qt5.qtbase.bin}/lib/qt-*/plugins/platforms \ - --set _TRIBLERPATH $out \ - --set PYTHONPATH $out:$program_PYTHONPATH \ + --set _TRIBLERPATH $out/src \ + --set PYTHONPATH $out/src/tribler-core:$out/src/tribler-common:$out/src/tribler-gui:$program_PYTHONPATH \ --set NO_AT_BRIDGE 1 \ --run 'cd $_TRIBLERPATH' \ - --add-flags "-O $out/run_tribler.py" \ - ${lib.optionalString enablePlayer '' - --prefix LD_LIBRARY_PATH : ${libvlc}/lib - ''} + --add-flags "-O $out/src/run_tribler.py" - mkdir -p $out/share/applications $out/share/icons $out/share/man/man1 - cp $out/Tribler/Main/Build/Ubuntu/tribler.desktop $out/share/applications/tribler.desktop - cp $out/Tribler/Main/Build/Ubuntu/tribler_big.xpm $out/share/icons/tribler.xpm - cp $out/Tribler/Main/Build/Ubuntu/tribler.1 $out/share/man/man1/tribler.1 + mkdir -p $out/share/applications $out/share/icons + cp $out/build/debian/tribler/usr/share/applications/tribler.desktop $out/share/applications/tribler.desktop + cp $out/build/debian/tribler/usr/share/pixmaps/tribler_big.xpm $out/share/icons/tribler.xpm ''; meta = with lib; { - maintainers = with maintainers; [ xvapx ]; + maintainers = with maintainers; [ xvapx viric ]; homepage = "https://www.tribler.org/"; description = "A completely decentralised P2P filesharing client based on the Bittorrent protocol"; license = licenses.lgpl21; platforms = platforms.linux; - broken = true; # 2021-03-17 see https://github.com/NixOS/nixpkgs/issues/93053 }; } diff --git a/pkgs/development/python-modules/aiohttp-apispec/unstable.nix b/pkgs/development/python-modules/aiohttp-apispec/unstable.nix new file mode 100644 index 000000000000..73a28de7b40d --- /dev/null +++ b/pkgs/development/python-modules/aiohttp-apispec/unstable.nix @@ -0,0 +1,37 @@ +{ lib, buildPythonPackage, fetchPypi, pythonOlder +, aiohttp, webargs, fetchFromGitHub, callPackage +}: + +let + apispec3 = callPackage ../apispec/3.nix {}; + jinja2 = callPackage ../jinja2/2.nix {}; +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/apispec/3.nix b/pkgs/development/python-modules/apispec/3.nix new file mode 100644 index 000000000000..e60a440df3f4 --- /dev/null +++ b/pkgs/development/python-modules/apispec/3.nix @@ -0,0 +1,47 @@ +{ 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/development/python-modules/jinja2/2.nix b/pkgs/development/python-modules/jinja2/2.nix index dce93d33ab50..153aebcc818e 100644 --- a/pkgs/development/python-modules/jinja2/2.nix +++ b/pkgs/development/python-modules/jinja2/2.nix @@ -24,7 +24,7 @@ buildPythonPackage rec { doCheck = !stdenv.is32bit || isPy3k; checkPhase = '' - pytest -v tests + pytest -v tests -W ignore::ResourceWarning -W ignore::DeprecationWarning ''; meta = with lib; { diff --git a/pkgs/development/python-modules/webargs/default.nix b/pkgs/development/python-modules/webargs/default.nix index 63ad60c9f084..e92b47d20933 100644 --- a/pkgs/development/python-modules/webargs/default.nix +++ b/pkgs/development/python-modules/webargs/default.nix @@ -16,8 +16,8 @@ buildPythonPackage rec { "webargs" ]; - propagatedBuildInputs = [ marshmallow ]; + checkInputs = [ pytestCheckHook pytest-aiohttp diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index b6d07f926e1f..f38e652d04f8 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -9788,6 +9788,8 @@ in { weasyprint = callPackage ../development/python-modules/weasyprint { }; + webargs = callPackage ../development/python-modules/webargs { }; + webapp2 = callPackage ../development/python-modules/webapp2 { }; webassets = callPackage ../development/python-modules/webassets { }; @@ -9806,8 +9808,6 @@ in { webhelpers = callPackage ../development/python-modules/webhelpers { }; - webargs = callPackage ../development/python-modules/webargs { }; - webob = callPackage ../development/python-modules/webob { }; weboob = callPackage ../development/python-modules/weboob { };