1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 pythonOlder,
6 pytestCheckHook,
7 indexed-bzip2,
8 indexed-gzip,
9 indexed-zstd,
10 python-xz,
11 setuptools,
12 rapidgzip,
13 rarfile,
14 zstandard, # Python bindings
15 zstd, # System tool
16}:
17
18buildPythonPackage rec {
19 pname = "ratarmountcore";
20 version = "0.6.3";
21 pyproject = true;
22
23 disabled = pythonOlder "3.6";
24
25 src = fetchFromGitHub {
26 owner = "mxmlnkn";
27 repo = "ratarmount";
28 rev = "core-v${version}";
29 hash = "sha256-2jG066BUkhyHRqRyFAucQRJrjXQNw2ccCxERKkltO3Y=";
30 fetchSubmodules = true;
31 };
32
33 sourceRoot = "${src.name}/core";
34
35 nativeBuildInputs = [ setuptools ];
36 propagatedBuildInputs = [
37 indexed-gzip
38 indexed-bzip2
39 indexed-zstd
40 python-xz
41 rapidgzip
42 rarfile
43 ];
44
45 pythonImportsCheck = [ "ratarmountcore" ];
46
47 nativeCheckInputs = [
48 pytestCheckHook
49 zstandard
50 zstd
51 ];
52
53 disabledTestPaths = [
54 # Disable this test because for arcane reasons running pytest with nix-build uses 10-100x
55 # more virtual memory than running the test directly or inside a local development nix-shell.
56 # This virtual memory usage caused os.fork called by Python multiprocessing to fail with
57 # "OSError: [Errno 12] Cannot allocate memory" on a test system with 16 GB RAM. It worked fine
58 # on a system with 96 GB RAM. In order to avoid build errors on "low"-memory systems, this
59 # test is disabled for now.
60 "tests/test_BlockParallelReaders.py"
61 ];
62
63 meta = with lib; {
64 description = "Library for accessing archives by way of indexing";
65 homepage = "https://github.com/mxmlnkn/ratarmount/tree/master/core";
66 license = licenses.mit;
67 maintainers = with lib.maintainers; [ mxmlnkn ];
68 };
69}