summary refs log tree commit diff
path: root/pkgs/development/python-modules
diff options
context:
space:
mode:
authorFrederik Rietdijk <freddyrietdijk@fridh.nl>2017-05-31 08:46:40 +0200
committerGitHub <noreply@github.com>2017-05-31 08:46:40 +0200
commit3488c65b2b02349276c87ae858ece19111f772aa (patch)
tree1a7c2b90d51e16e6809e73f4e0ed61d29387d4f4 /pkgs/development/python-modules
parent98d584c8d9355a0e218e102365742d5d37d2e075 (diff)
parent0697dd8b8105714a3acecc431954072492a66383 (diff)
downloadnixlib-3488c65b2b02349276c87ae858ece19111f772aa.tar
nixlib-3488c65b2b02349276c87ae858ece19111f772aa.tar.gz
nixlib-3488c65b2b02349276c87ae858ece19111f772aa.tar.bz2
nixlib-3488c65b2b02349276c87ae858ece19111f772aa.tar.lz
nixlib-3488c65b2b02349276c87ae858ece19111f772aa.tar.xz
nixlib-3488c65b2b02349276c87ae858ece19111f772aa.tar.zst
nixlib-3488c65b2b02349276c87ae858ece19111f772aa.zip
Merge pull request #26268 from Profpatsch/rarfile-unrar-libarchive
pythonPackages.rarfile: use free libarchive by default.
Diffstat (limited to 'pkgs/development/python-modules')
-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 183e5a2f1d93..c2c8c926432a 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"