tribler: 7.4.4 -> 7.10.0

This also adds old versions of apispec and webargs that tribler
requires, and aiohttp-apispec as well.
This commit is contained in:
Lluís Batlle i Rossell 2021-11-24 17:40:40 +01:00
parent c935f5e0ad
commit 2d083acf66
6 changed files with 123 additions and 35 deletions

View File

@ -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
};
}

View File

@ -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 ];
};
}

View File

@ -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 ];
};
}

View File

@ -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; {

View File

@ -16,8 +16,8 @@ buildPythonPackage rec {
"webargs"
];
propagatedBuildInputs = [ marshmallow ];
checkInputs = [
pytestCheckHook
pytest-aiohttp

View File

@ -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 { };