Merge pull request #56323 from costrouc/python-ansible-refactor

Move ansible to python-modules and use toPythonApplication + ansible related packages
This commit is contained in:
Robert Schütz
2019-03-01 21:08:54 +01:00
committed by GitHub
10 changed files with 235 additions and 109 deletions

View File

@@ -1,72 +1,27 @@
{ stdenv, fetchurl, python2
, windowsSupport ? false
}:
{ python3Packages, fetchurl }:
let
generic = { version, sha256, py ? python2 }: py.pkgs.buildPythonPackage rec {
{
ansible = with python3Packages; toPythonApplication ansible;
ansible_2_7 = with python3Packages; toPythonApplication ansible;
ansible_2_6 = with python3Packages; toPythonApplication (ansible.overridePythonAttrs(old: rec {
pname = "ansible";
inherit version;
outputs = [ "out" "man" ];
version = "2.6.9";
src = fetchurl {
url = "https://releases.ansible.com/ansible/${pname}-${version}.tar.gz";
inherit sha256;
sha256 = "12mysvdavkypgmyms1wjq2974lk97w893k23i6khigxrjj6r85z1";
};
}));
prePatch = ''
sed -i "s,/usr/,$out," lib/ansible/constants.py
'';
ansible_2_5 = with python3Packages; toPythonApplication (ansible.overridePythonAttrs(old: rec {
pname = "ansible";
version = "2.5.14";
postInstall = ''
wrapPythonProgramsIn "$out/bin" "$out $PYTHONPATH"
for m in docs/man/man1/*; do
install -vD $m -t $man/share/man/man1
done
'';
doCheck = false;
dontStrip = true;
dontPatchELF = true;
dontPatchShebangs = false;
propagatedBuildInputs = with py.pkgs; [
pycrypto paramiko jinja2 pyyaml httplib2 boto six netaddr dnspython jmespath dopy
] ++ stdenv.lib.optional windowsSupport pywinrm;
meta = with stdenv.lib; {
homepage = http://www.ansible.com;
description = "A simple automation tool";
license = with licenses; [ gpl3 ] ;
maintainers = with maintainers; [ jgeerds joamaki ];
platforms = with platforms; linux ++ darwin;
src = fetchurl {
url = "https://releases.ansible.com/ansible/${pname}-${version}.tar.gz";
sha256 = "0sd04h2k5qv4m48dn76jkjlwlqfdk15hzyagj9i71r8brvmwhnk9";
};
};
in rec {
# We will carry all the supported versions
ansible_2_4 = generic {
version = "2.4.4.0";
sha256 = "0n1k6h0h6av74nw8vq98fmh6q4pq6brpwmx45282vh3bkdmpa0ib";
};
ansible_2_5 = generic {
version = "2.5.11";
sha256 = "07rhgkl3a2ba59rqh9pyz1p661gc389shlwa2sw1m6wwifg4lm24";
};
ansible_2_6 = generic {
version = "2.6.7";
sha256 = "10pakw9k9wd3cy1qk3ah2253ph7c7h3qzpal4k0s5lschzgy2fh0";
};
ansible_2_7 = generic {
version = "2.7.6";
sha256 = "0f7b2ghm34ql8yv90wr0ngd6w7wyvnlcxpc3snkj86kcjsnmx1bd";
};
ansible2 = ansible_2_7;
ansible = ansible2;
}));
}