fail2ban: python packaging workaround for /etc/fail2ban installation (fixes #11534)

Removed path substitutions from setup.py because these should be handled
by the setuptools install prefix.

Except that the install prefix won't quite work until issue #4968 is
resolved.

In the meantime there are preInstall and postInstall scripts so that
this package continues to work with the nix python packaging
improvements.
This commit is contained in:
Rodney Lorrimar 2015-12-13 16:36:21 +00:00
parent 2eb8c3e491
commit 242c24c402

View file

@ -18,14 +18,6 @@ pythonPackages.buildPythonPackage {
++ [ python.modules.sqlite3 gamin ];
preConfigure = ''
substituteInPlace setup.cfg \
--replace /usr $out
substituteInPlace setup.py \
--replace /usr $out \
--replace /etc $out/etc \
--replace /var $TMPDIR/var \
for i in fail2ban-client fail2ban-regex fail2ban-server; do
substituteInPlace $i \
--replace /usr/share/fail2ban $out/share/fail2ban
@ -40,6 +32,18 @@ pythonPackages.buildPythonPackage {
doCheck = false;
preInstall = ''
# see https://github.com/NixOS/nixpkgs/issues/4968
${python}/bin/${python.executable} setup.py install_data --install-dir=$out --root=$out
'';
postInstall = let
sitePackages = "$out/lib/${python.libPrefix}/site-packages";
in ''
# see https://github.com/NixOS/nixpkgs/issues/4968
rm -rf ${sitePackages}/etc ${sitePackages}/usr ${sitePackages}/var;
'';
meta = with stdenv.lib; {
homepage = http://www.fail2ban.org/;
description = "A program that scans log files for repeated failing login attempts and bans IP addresses";