summary refs log tree commit diff
path: root/pkgs/development/python-modules/rarfile
diff options
context:
space:
mode:
authorProfpatsch <mail@profpatsch.de>2017-05-31 05:53:29 +0200
committerProfpatsch <mail@profpatsch.de>2017-05-31 05:53:29 +0200
commit0697dd8b8105714a3acecc431954072492a66383 (patch)
treebfc9237dcdb041cdb5e2e7d54adc51cac0fcb5f1 /pkgs/development/python-modules/rarfile
parent789bde24088c8b99f5596de271f57691409b7640 (diff)
downloadnixpkgs-0697dd8b8105714a3acecc431954072492a66383.tar
nixpkgs-0697dd8b8105714a3acecc431954072492a66383.tar.gz
nixpkgs-0697dd8b8105714a3acecc431954072492a66383.tar.bz2
nixpkgs-0697dd8b8105714a3acecc431954072492a66383.tar.lz
nixpkgs-0697dd8b8105714a3acecc431954072492a66383.tar.xz
nixpkgs-0697dd8b8105714a3acecc431954072492a66383.tar.zst
nixpkgs-0697dd8b8105714a3acecc431954072492a66383.zip
pythonPackages.rarfile: use free libarchive by default.
`unrar` is a non-free package, so it should only be used on request.
rarfile can use the rar-mode of `libarchive` instead, which should work well
enough for most cases.
Diffstat (limited to 'pkgs/development/python-modules/rarfile')
-rw-r--r--pkgs/development/python-modules/rarfile/default.nix20
1 files changed, 17 insertions, 3 deletions
diff --git a/pkgs/development/python-modules/rarfile/default.nix b/pkgs/development/python-modules/rarfile/default.nix
index 183e5a2f1d9..c2c8c926432 100644
--- a/pkgs/development/python-modules/rarfile/default.nix
+++ b/pkgs/development/python-modules/rarfile/default.nix
@@ -1,4 +1,10 @@
-{ stdenv, buildPythonPackage, fetchFromGitHub, pytest, nose, unrar, glibcLocales }:
+{ stdenv, buildPythonPackage, fetchFromGitHub, pytest, nose, libarchive, glibcLocales
+# unrar is non-free software
+, useUnrar ? false, unrar
+}:
+
+assert useUnrar -> unrar != null;
+assert !useUnrar -> libarchive != null;
 
 buildPythonPackage rec {
   pname = "rarfile";
@@ -15,8 +21,16 @@ buildPythonPackage rec {
 
   prePatch = ''
     substituteInPlace rarfile.py \
-      --replace 'UNRAR_TOOL = "unrar"' "UNRAR_TOOL = \"${unrar}/bin/unrar\""
-  '';
+  '' + (if useUnrar then
+        ''--replace 'UNRAR_TOOL = "unrar"' "UNRAR_TOOL = \"${unrar}/bin/unrar\""
+        ''
+       else
+        ''--replace 'ALT_TOOL = "bsdtar"' "ALT_TOOL = \"${libarchive}/bin/bsdtar\""
+        '')
+     + ''
+   '';
+  # the tests only work with the standard unrar package
+  doCheck = useUnrar;
   LC_ALL = "en_US.UTF-8";
   checkPhase = ''
     py.test test -k "not test_printdir"