From 61f566d45b1a15bbb1a029ca016a9938d5f98f85 Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Wed, 7 Apr 2021 23:18:02 +0200 Subject: [PATCH 1/3] python3Packages.pytest-raises: init at 0.11 --- .../python-modules/pytest-raises/default.nix | 30 +++++++++++++++++++ pkgs/top-level/python-packages.nix | 6 ++++ 2 files changed, 36 insertions(+) create mode 100644 pkgs/development/python-modules/pytest-raises/default.nix diff --git a/pkgs/development/python-modules/pytest-raises/default.nix b/pkgs/development/python-modules/pytest-raises/default.nix new file mode 100644 index 00000000000..7891437909e --- /dev/null +++ b/pkgs/development/python-modules/pytest-raises/default.nix @@ -0,0 +1,30 @@ +{ lib +, buildPythonPackage +, fetchFromGitHub +, pytestCheckHook +}: + +buildPythonPackage rec { + pname = "pytest-raises"; + version = "0.11"; + + src = fetchFromGitHub { + owner = "Lemmons"; + repo = pname; + rev = version; + sha256 = "0gbb4kml2qv7flp66i73mgb4qihdaybb6c96b5dw3mhydhymcsy2"; + }; + + checkInputs = [ + pytestCheckHook + ]; + + pythonImportsCheck = [ "pytest_raises" ]; + + meta = with lib; { + description = "An implementation of pytest.raises as a pytest.mark fixture"; + homepage = "https://github.com/Lemmons/pytest-raises"; + license = with licenses; [ mit ]; + maintainers = with maintainers; [ fab ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 10da6e1f33c..4e0af09e84d 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -236,6 +236,8 @@ in { aiocontextvars = callPackage ../development/python-modules/aiocontextvars { }; + aiodiscover = callPackage ../development/python-modules/aiodiscover { }; + aiodns = callPackage ../development/python-modules/aiodns { }; aioeafm = callPackage ../development/python-modules/aioeafm { }; @@ -538,6 +540,8 @@ in { async_generator = callPackage ../development/python-modules/async_generator { }; + async-dns = callPackage ../development/python-modules/async-dns { }; + asyncio-dgram = callPackage ../development/python-modules/asyncio-dgram { }; asyncio-mqtt = callPackage ../development/python-modules/asyncio_mqtt { }; @@ -6567,6 +6571,8 @@ in { pytest-quickcheck = self.pytestquickcheck; pytestquickcheck = callPackage ../development/python-modules/pytest-quickcheck { }; + pytest-raises = callPackage ../development/python-modules/pytest-raises { }; + pytest-raisesregexp = callPackage ../development/python-modules/pytest-raisesregexp { }; pytest-randomly = callPackage ../development/python-modules/pytest-randomly { }; From 4a238865363c4277288351ff4e710de21ee7c7d9 Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Wed, 7 Apr 2021 23:18:36 +0200 Subject: [PATCH 2/3] python3Packages.async-dns: init at 1.1.9 --- .../python-modules/async-dns/default.nix | 52 +++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 pkgs/development/python-modules/async-dns/default.nix diff --git a/pkgs/development/python-modules/async-dns/default.nix b/pkgs/development/python-modules/async-dns/default.nix new file mode 100644 index 00000000000..fdf240f5ba9 --- /dev/null +++ b/pkgs/development/python-modules/async-dns/default.nix @@ -0,0 +1,52 @@ +{ lib +, buildPythonPackage +, fetchFromGitHub +, fetchpatch +, poetry-core +, python +, pythonOlder +}: + +buildPythonPackage rec { + pname = "async-dns"; + version = "1.1.9"; + disabled = pythonOlder "3.6"; + format = "pyproject"; + + src = fetchFromGitHub { + owner = "gera2ld"; + repo = "async_dns"; + rev = "v${version}"; + sha256 = "1z8j0s3dwcyavarhx41q75k1cmfzmwiqdh4svv3v15np26cywyag"; + }; + + nativeBuildInputs = [ + poetry-core + ]; + + patches = [ + # Switch to poetry-core, https://github.com/gera2ld/async_dns/pull/22 + # Can be remove for async-dns>1.1.9 + (fetchpatch { + name = "switch-to-poetry-core.patch"; + url = "https://github.com/gera2ld/async_dns/commit/25fee497aae3bde0ddf9f8804d249a27edbe607e.patch"; + sha256 = "0w4zlppnp1a2q1wasc95ymqx3djswl32y5nw6fvz3nn8jg4gc743"; + }) + ]; + + checkPhase = '' + export HOME=$TMPDIR + # Test needs network access + rm tests/test_resolver.py + ${python.interpreter} -m unittest + ''; + + pythonImportsCheck = [ "async_dns" ]; + + meta = with lib; { + description = "Python DNS library"; + homepage = "https://github.com/gera2ld/async_dns"; + license = with licenses; [ mit ]; + maintainers = with maintainers; [ fab ]; + }; +} From eca0abfd504e6380ace27c00386d385a95d962c5 Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Wed, 7 Apr 2021 23:29:44 +0200 Subject: [PATCH 3/3] python3Packages.aiodiscover: init at 1.3.2 --- .../python-modules/aiodiscover/default.nix | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 pkgs/development/python-modules/aiodiscover/default.nix diff --git a/pkgs/development/python-modules/aiodiscover/default.nix b/pkgs/development/python-modules/aiodiscover/default.nix new file mode 100644 index 00000000000..923be510c45 --- /dev/null +++ b/pkgs/development/python-modules/aiodiscover/default.nix @@ -0,0 +1,51 @@ +{ lib +, async-dns +, buildPythonPackage +, fetchFromGitHub +, fetchpatch +, ifaddr +, pyroute2 +, pythonOlder +}: + +buildPythonPackage rec { + pname = "aiodiscover"; + version = "1.3.2"; + disabled = pythonOlder "3.7"; + + src = fetchFromGitHub { + owner = "bdraco"; + repo = pname; + rev = "v${version}"; + sha256 = "0qg2wm6ddsfai788chylr5ynrvakwg91q3dszz7dxzbkfdcxixj3"; + }; + + patches = [ + (fetchpatch { + name = "remove-entry_point.patch"; + url = "https://github.com/bdraco/aiodiscover/commit/4c497fb7d4c8685a78209c710e92e0bd17f46bb2.patch"; + sha256 = "0py9alhg6qdncbn6a04mrnjhs4j19kg759dv69knpqzryikcfa63"; + }) + ]; + + propagatedBuildInputs = [ + async-dns + pyroute2 + ifaddr + ]; + + postPatch = '' + substituteInPlace setup.py --replace '"pytest-runner>=5.2",' "" + ''; + + # Tests require access to /etc/resolv.conf + # pythonImportsCheck doesn't work as async-dns wants to create its CONFIG_DIR + doCheck = false; + + meta = with lib; { + description = "Python module to discover hosts via ARP and PTR lookup"; + homepage = "https://github.com/bdraco/aiodiscover"; + license = with licenses; [ asl20 ]; + maintainers = with maintainers; [ fab ]; + }; +}