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.1.2"; 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-8DjmYYTb0BR5KvtSeI2s7VtYdbRSI+QCjhZfDwqnk3M="; 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 ] 62 ++ lib.flatten (builtins.attrValues optional-dependencies); 63 64 pythonImportsCheck = [ "ratarmountcore" ]; 65 66 disabledTestPaths = [ 67 # Disable this test because for arcane reasons running pytest with nix-build uses 10-100x 68 # more virtual memory than running the test directly or inside a local development nix-shell. 69 # This virtual memory usage caused os.fork called by Python multiprocessing to fail with 70 # "OSError: [Errno 12] Cannot allocate memory" on a test system with 16 GB RAM. It worked fine 71 # on a system with 96 GB RAM. In order to avoid build errors on "low"-memory systems, this 72 # test is disabled for now. 73 "tests/test_BlockParallelReaders.py" 74 ]; 75 76 disabledTests = [ 77 # Tests with issues 78 "test_file_versions" 79 "test_stream_compressed" 80 "test_chimera_file" 81 "test_URLContextManager" 82 "test_URL" 83 ]; 84 85 meta = with lib; { 86 description = "Library for accessing archives by way of indexing"; 87 homepage = "https://github.com/mxmlnkn/ratarmount/tree/master/core"; 88 changelog = "https://github.com/mxmlnkn/ratarmount/blob/core-${src.tag}/core/CHANGELOG.md"; 89 license = licenses.mit; 90 maintainers = with lib.maintainers; [ mxmlnkn ]; 91 }; 92}