diff --git a/pkgs/development/python-modules/gmpy/default.nix b/pkgs/development/python-modules/gmpy/default.nix new file mode 100644 index 000000000000..81af4b5e5501 --- /dev/null +++ b/pkgs/development/python-modules/gmpy/default.nix @@ -0,0 +1,24 @@ +{ buildPythonPackage, fetchurl, isPyPy, gmp } : + +let + pname = "gmpy"; + version = "1.17"; +in + +buildPythonPackage { + inherit pname version; + + disabled = isPyPy; + + src = fetchurl { + url = "mirror://pypi/g/gmpy/${pname}-${version}.zip"; + sha256 = "1a79118a5332b40aba6aa24b051ead3a31b9b3b9642288934da754515da8fa14"; + }; + + buildInputs = [ gmp ]; + + meta = { + description = "GMP or MPIR interface to Python 2.4+ and 3.x"; + homepage = http://code.google.com/p/gmpy/; + }; +} diff --git a/pkgs/development/python-modules/gmpy2/default.nix b/pkgs/development/python-modules/gmpy2/default.nix new file mode 100644 index 000000000000..5d1f82356a01 --- /dev/null +++ b/pkgs/development/python-modules/gmpy2/default.nix @@ -0,0 +1,25 @@ +{ stdenv, buildPythonPackage, fetchurl, isPyPy, gmp, mpfr, libmpc } : + +let + pname = "gmpy2"; + version = "2.0.8"; +in + +buildPythonPackage { + inherit pname version; + + disabled = isPyPy; + + src = fetchurl { + url = "mirror://pypi/g/gmpy2/${pname}-${version}.zip"; + sha256 = "0grx6zmi99iaslm07w6c2aqpnmbkgrxcqjrqpfq223xri0r3w8yx"; + }; + + buildInputs = [ gmp mpfr libmpc ]; + + meta = with stdenv.lib; { + description = "GMP/MPIR, MPFR, and MPC interface to Python 2.6+ and 3.x"; + homepage = http://code.google.com/p/gmpy/; + license = licenses.gpl3Plus; + }; +} diff --git a/pkgs/development/python-modules/phe/default.nix b/pkgs/development/python-modules/phe/default.nix new file mode 100644 index 000000000000..b016a9bd92c3 --- /dev/null +++ b/pkgs/development/python-modules/phe/default.nix @@ -0,0 +1,29 @@ +{ stdenv, buildPythonPackage, fetchPypi, isPyPy, isPy3k, click, gmpy2, numpy } : + +let + pname = "phe"; + version = "1.4.0"; +in + +buildPythonPackage { + inherit pname version; + + # https://github.com/n1analytics/python-paillier/issues/51 + disabled = isPyPy || ! isPy3k; + + src = fetchPypi { + inherit pname version; + sha256 = "0wzlk7d24kp0f5kpm0kvvc88mm42144f5cg9pcpb1dsfha75qy5m"; + }; + + buildInputs = [ click gmpy2 numpy ]; + + # 29/233 tests fail + doCheck = false; + + meta = with stdenv.lib; { + description = "A library for Partially Homomorphic Encryption in Python"; + homepage = https://github.com/n1analytics/python-paillier; + license = licenses.gpl3; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 9b98a1af7891..137463b74db6 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -2624,48 +2624,9 @@ in { GeoIP = callPackage ../development/python-modules/GeoIP { }; - gmpy = buildPythonPackage rec { - name = "gmpy-1.17"; - disabled = isPyPy; + gmpy = callPackage ../development/python-modules/gmpy { }; - src = pkgs.fetchurl { - url = "mirror://pypi/g/gmpy/${name}.zip"; - sha256 = "1a79118a5332b40aba6aa24b051ead3a31b9b3b9642288934da754515da8fa14"; - }; - - buildInputs = [ - pkgs.gcc - pkgs.gmp - ]; - - meta = { - description = "GMP or MPIR interface to Python 2.4+ and 3.x"; - homepage = http://code.google.com/p/gmpy/; - }; - }; - - gmpy2 = buildPythonPackage rec { - name = "gmpy2-2.0.6"; - disabled = isPyPy; - - src = pkgs.fetchurl { - url = "mirror://pypi/g/gmpy2/${name}.zip"; - sha256 = "5041d0ae24407c24487106099f5bcc4abb1a5f58d90e6712cc95321975eddbd4"; - }; - - buildInputs = [ - pkgs.gcc - pkgs.gmp - pkgs.mpfr - pkgs.libmpc - ]; - - meta = { - description = "GMP/MPIR, MPFR, and MPC interface to Python 2.6+ and 3.x"; - homepage = http://code.google.com/p/gmpy/; - license = licenses.gpl3Plus; - }; - }; + gmpy2 = callPackage ../development/python-modules/gmpy2 { }; gmusicapi = with pkgs; buildPythonPackage rec { name = "gmusicapi-10.1.0"; @@ -3732,6 +3693,8 @@ in { }; }; + phe = callPackage ../development/python-modules/phe { }; + phpserialize = callPackage ../development/python-modules/phpserialize { }; plaid-python = callPackage ../development/python-modules/plaid-python { };