pytrainer: unpin python 3.10
[NixPkgs.git] / pkgs / games / portmod / default.nix
bloba0e7d38d178c3d865c8041442a1d9f0b1fb64b7a
1 { lib
2 , bubblewrap
3 , cacert
4 , fetchFromGitLab
5 , git
6 , imagemagick
7 , openmw
8 , python3Packages
9 , rustPlatform
10 , tes3cmd
11 , tr-patcher
14 let
15   version = "2.6.2";
17   src = fetchFromGitLab {
18     owner = "portmod";
19     repo = "Portmod";
20     rev = "v${version}";
21     hash = "sha256-ufr2guaPdCvI5JOicL/lTrT3t6UlaY1hEB2xbwzhw6A=";
22   };
24   portmod-rust = rustPlatform.buildRustPackage rec {
25     inherit src version;
26     pname = "portmod-rust";
28     cargoHash = "sha256-sAjgGVVjgXaWbmN/eGEvatYjkHeFTZNX1GXFcJqs3GI=";
30     nativeBuildInputs = [
31       python3Packages.python
32     ];
34     doCheck = false;
35   };
37   bin-programs = [
38     bubblewrap
39     git
40     python3Packages.virtualenv
41     tr-patcher
42     tes3cmd
43     imagemagick
44     openmw
45   ];
48 python3Packages.buildPythonApplication rec {
49   inherit src version;
51   pname = "portmod";
52   format = "pyproject";
54   # build the rust library independantly
55   prePatch = ''
56     substituteInPlace setup.py \
57       --replace "from setuptools_rust import Binding, RustExtension, Strip" "" \
58       --replace "RustExtension(\"portmodlib.portmod\", binding=Binding.PyO3, strip=Strip.Debug)" ""
60     substituteInPlace pyproject.toml \
61       --replace '"setuptools-rust"' ""
62   '';
64   nativeBuildInputs = with python3Packages; [
65     setuptools
66     wheel
67   ];
69   propagatedBuildInputs = with python3Packages; [
70     setuptools-scm
71     setuptools
72     requests
73     chardet
74     colorama
75     deprecated
76     restrictedpython
77     appdirs
78     gitpython
79     progressbar2
80     python-sat
81     redbaron
82     patool
83     packaging
84     fasteners
85   ];
87   nativeCheckInputs = with python3Packages; [
88     pytestCheckHook
89   ] ++ bin-programs;
91   preCheck = ''
92     cp ${portmod-rust}/lib/libportmod.so portmodlib/portmod.so
93     export HOME=$(mktemp -d)
94   '';
96   # some test require network access
97   disabledTests = [
98     "test_masters_esp"
99     "test_logging"
100     "test_execute_network_permissions"
101     "test_execute_permissions_bleed"
102     "test_git"
103     "test_sync"
104     "test_manifest"
105     "test_add_repo"
106     "test_init_prefix_interactive"
107     "test_scan_sources"
108     "test_unpack"
109   ];
111   # for some reason, installPhase doesn't copy the compiled binary
112   postInstall = ''
113     cp ${portmod-rust}/lib/libportmod.so $out/${python3Packages.python.sitePackages}/portmodlib/portmod.so
115     makeWrapperArgs+=("--prefix" "GIT_SSL_CAINFO" ":" "${cacert}/etc/ssl/certs/ca-bundle.crt" \
116       "--prefix" "PATH" ":" "${lib.makeBinPath bin-programs }")
117   '';
119   meta = with lib; {
120     description = "mod manager for openMW based on portage";
121     homepage = "https://gitlab.com/portmod/portmod";
122     license = licenses.gpl3Only;
123     maintainers = with maintainers; [ marius851000 ];
124   };