1{ 2 lib, 3 buildPythonPackage, 4 fetchFromGitHub, 5 fsspec, 6 indexed-gzip, 7 indexed-zstd, 8 libarchive-c, 9 pytestCheckHook, 10 python-xz, 11 pythonOlder, 12 writableTmpDirAsHomeHook, 13 rapidgzip, 14 rarfile, 15 setuptools, 16 zstandard, # Python bindings 17 zstd, # System tool 18}: 19 20buildPythonPackage rec { 21 pname = "ratarmountcore"; 22 version = "1.0.0"; 23 pyproject = true; 24 25 disabled = pythonOlder "3.10"; 26 27 src = fetchFromGitHub { 28 owner = "mxmlnkn"; 29 repo = "ratarmount"; 30 tag = "v${version}"; 31 hash = "sha256-nTKbwZoD7nf3cKFJOR5p6ZRFHsKVeJXboOAhPjvnQAM="; 32 fetchSubmodules = true; 33 }; 34 35 sourceRoot = "${src.name}/core"; 36 37 build-system = [ setuptools ]; 38 39 optional-dependencies = { 40 full = [ 41 indexed-gzip 42 indexed-zstd 43 python-xz 44 rapidgzip 45 rarfile 46 ]; 47 _7z = [ libarchive-c ]; 48 bzip2 = [ rapidgzip ]; 49 gzip = [ indexed-gzip ]; 50 rar = [ rarfile ]; 51 xz = [ python-xz ]; 52 zstd = [ indexed-zstd ]; 53 }; 54 55 nativeCheckInputs = [ 56 pytestCheckHook 57 zstandard 58 zstd 59 fsspec 60 writableTmpDirAsHomeHook 61 ] ++ lib.flatten (builtins.attrValues optional-dependencies); 62 63 pythonImportsCheck = [ "ratarmountcore" ]; 64 65 disabledTestPaths = [ 66 # Disable this test because for arcane reasons running pytest with nix-build uses 10-100x 67 # more virtual memory than running the test directly or inside a local development nix-shell. 68 # This virtual memory usage caused os.fork called by Python multiprocessing to fail with 69 # "OSError: [Errno 12] Cannot allocate memory" on a test system with 16 GB RAM. It worked fine 70 # on a system with 96 GB RAM. In order to avoid build errors on "low"-memory systems, this 71 # test is disabled for now. 72 "tests/test_BlockParallelReaders.py" 73 ]; 74 75 disabledTests = [ 76 # Tests with issues 77 "test_file_versions" 78 "test_stream_compressed" 79 "test_chimera_file" 80 "test_URLContextManager" 81 "test_URL" 82 ]; 83 84 meta = with lib; { 85 description = "Library for accessing archives by way of indexing"; 86 homepage = "https://github.com/mxmlnkn/ratarmount/tree/master/core"; 87 changelog = "https://github.com/mxmlnkn/ratarmount/blob/core-${src.tag}/core/CHANGELOG.md"; 88 license = licenses.mit; 89 maintainers = with lib.maintainers; [ mxmlnkn ]; 90 }; 91}