pythonPackages.ansible: refactor move to python-modules

This commit is contained in:
Chris Ostrouchov 2019-02-24 16:52:48 -05:00
parent e48e6ca40a
commit 300ca8132b
No known key found for this signature in database
GPG Key ID: 9ED59B0AB1EAF573
4 changed files with 81 additions and 67 deletions

View File

@ -0,0 +1,53 @@
{ lib
, fetchurl
, buildPythonPackage
, pycrypto
, paramiko
, jinja2
, pyyaml
, httplib2
, boto
, six
, netaddr
, dnspython
, jmespath
, dopy
, windowsSupport ? false
, pywinrm
}:
buildPythonPackage rec {
pname = "ansible";
version = "2.7.8";
src = fetchurl {
url = "https://releases.ansible.com/ansible/${pname}-${version}.tar.gz";
sha256 = "11yx7vd0mp5gkq428af141dwnrwf8f9cp3f65243qbs9icjxnrrx";
};
prePatch = ''
sed -i "s,/usr/,$out," lib/ansible/constants.py
'';
postInstall = ''
for m in docs/man/man1/*; do
install -vD $m -t $out/share/man/man1
done
'';
propagatedBuildInputs = [
pycrypto paramiko jinja2 pyyaml httplib2 boto
six netaddr dnspython jmespath dopy
] ++ lib.optional windowsSupport pywinrm;
# dificult to test
doCheck = false;
meta = with lib; {
homepage = http://www.ansible.com;
description = "Radically simple IT automation";
license = [ licenses.gpl3 ] ;
maintainers = with maintainers; [ jgeerds joamaki costrouc ];
platforms = platforms.linux ++ platforms.darwin;
};
}

View File

@ -1,72 +1,27 @@
{ stdenv, fetchurl, python2 { python3Packages, fetchurl }:
, windowsSupport ? false
}:
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"; pname = "ansible";
inherit version; version = "2.6.9";
outputs = [ "out" "man" ];
src = fetchurl { src = fetchurl {
url = "https://releases.ansible.com/ansible/${pname}-${version}.tar.gz"; url = "https://releases.ansible.com/ansible/${pname}-${version}.tar.gz";
inherit sha256; sha256 = "12mysvdavkypgmyms1wjq2974lk97w893k23i6khigxrjj6r85z1";
}; };
}));
prePatch = '' ansible_2_5 = with python3Packages; toPythonApplication (ansible.overridePythonAttrs(old: rec {
sed -i "s,/usr/,$out," lib/ansible/constants.py pname = "ansible";
''; version = "2.5.14";
postInstall = '' src = fetchurl {
wrapPythonProgramsIn "$out/bin" "$out $PYTHONPATH" url = "https://releases.ansible.com/ansible/${pname}-${version}.tar.gz";
sha256 = "0sd04h2k5qv4m48dn76jkjlwlqfdk15hzyagj9i71r8brvmwhnk9";
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;
}; };
}; }));
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;
} }

View File

@ -8295,13 +8295,11 @@ in
augeas = callPackage ../tools/system/augeas { }; augeas = callPackage ../tools/system/augeas { };
inherit (callPackages ../tools/admin/ansible {}) inherit (callPackage ../tools/admin/ansible { })
ansible_2_4 ansible
ansible_2_5 ansible_2_5
ansible_2_6 ansible_2_6
ansible_2_7 ansible_2_7;
ansible2
ansible;
ansible-lint = callPackage ../development/tools/ansible-lint {}; ansible-lint = callPackage ../development/tools/ansible-lint {};

View File

@ -912,6 +912,14 @@ in {
allpairspy = callPackage ../development/python-modules/allpairspy { }; allpairspy = callPackage ../development/python-modules/allpairspy { };
ansible = callPackage ../development/python-modules/ansible { };
ansible-kernel = callPackage ../development/python-modules/ansible-kernel { };
ansible-lint = callPackage ../development/python-modules/ansible-lint { };
ansible-runner = callPackage ../development/python-modules/ansible-runner { };
ansicolors = callPackage ../development/python-modules/ansicolors {}; ansicolors = callPackage ../development/python-modules/ansicolors {};
aniso8601 = callPackage ../development/python-modules/aniso8601 {}; aniso8601 = callPackage ../development/python-modules/aniso8601 {};