nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 59 lines 1.2 kB view raw
1{ 2 lib, 3 buildPythonPackage, 4 fetchFromGitHub, 5 pytestCheckHook, 6 libarchive, 7 setuptools, 8 # unrar is non-free software 9 useUnrar ? false, 10 unrar, 11}: 12 13assert useUnrar -> unrar != null; 14assert !useUnrar -> libarchive != null; 15 16buildPythonPackage rec { 17 pname = "rarfile"; 18 version = "4.2"; 19 pyproject = true; 20 21 src = fetchFromGitHub { 22 owner = "markokr"; 23 repo = "rarfile"; 24 tag = "v${version}"; 25 hash = "sha256-ZiwD2LG25fMd4Z+QWsh/x3ceG5QRBH4s/TZDwMnfpNI="; 26 }; 27 28 prePatch = '' 29 substituteInPlace rarfile.py \ 30 '' 31 + ( 32 if useUnrar then 33 '' 34 --replace 'UNRAR_TOOL = "unrar"' "UNRAR_TOOL = \"${unrar}/bin/unrar\"" 35 '' 36 else 37 '' 38 --replace 'ALT_TOOL = "bsdtar"' "ALT_TOOL = \"${libarchive}/bin/bsdtar\"" 39 '' 40 ) 41 + ""; 42 43 build-system = [ setuptools ]; 44 45 nativeCheckInputs = [ pytestCheckHook ]; 46 47 # The tests only work with the standard unrar package 48 doCheck = useUnrar; 49 50 pythonImportsCheck = [ "rarfile" ]; 51 52 meta = { 53 description = "RAR archive reader for Python"; 54 homepage = "https://github.com/markokr/rarfile"; 55 changelog = "https://github.com/markokr/rarfile/releases/tag/v${version}"; 56 license = lib.licenses.isc; 57 maintainers = [ ]; 58 }; 59}