From 6281fca1610cf4ecda47ea6c04887989fbde0098 Mon Sep 17 00:00:00 2001 From: Kristoffer Føllesdal Date: Thu, 12 May 2022 10:36:30 +0200 Subject: httpie: Make available as python library --- pkgs/development/python-modules/httpie/default.nix | 91 ++++++++++++++++++++++ pkgs/tools/networking/httpie/default.nix | 74 ------------------ pkgs/top-level/all-packages.nix | 2 +- pkgs/top-level/python-packages.nix | 2 + 4 files changed, 94 insertions(+), 75 deletions(-) create mode 100644 pkgs/development/python-modules/httpie/default.nix delete mode 100644 pkgs/tools/networking/httpie/default.nix diff --git a/pkgs/development/python-modules/httpie/default.nix b/pkgs/development/python-modules/httpie/default.nix new file mode 100644 index 00000000000..4f852bb3c25 --- /dev/null +++ b/pkgs/development/python-modules/httpie/default.nix @@ -0,0 +1,91 @@ +{ lib +, buildPythonPackage +, fetchFromGitHub +, installShellFiles +, pandoc +, pythonOlder +# BuildInputs +, charset-normalizer +, defusedxml +, multidict +, pygments +, requests +, requests-toolbelt +, setuptools +, rich +, pysocks +# CheckInputs +, pytest-httpbin +, pytest-lazy-fixture +, pytest-mock +, pytestCheckHook +, responses +, werkzeug +}: + +buildPythonPackage rec { + pname = "httpie"; + version = "3.2.1"; + format = "setuptools"; + + src = fetchFromGitHub { + owner = "httpie"; + repo = "httpie"; + rev = version; + hash = "sha256-WEe8zSlNckl7bPBi6u8mHQ1/xPw3kE81F8Xr15TchgM="; + }; + + nativeBuildInputs = [ + installShellFiles + pandoc + ]; + + propagatedBuildInputs = [ + charset-normalizer + defusedxml + multidict + pygments + requests + requests-toolbelt + setuptools + rich + pysocks + ]; + + checkInputs = [ + pytest-httpbin + pytest-lazy-fixture + pytest-mock + pytestCheckHook + responses + werkzeug + ]; + + postInstall = '' + # install completions + installShellCompletion --bash \ + --name http.bash extras/httpie-completion.bash + installShellCompletion --fish \ + --name http.fish extras/httpie-completion.fish + + # convert the docs/README.md file + pandoc --standalone -f markdown -t man docs/README.md -o docs/http.1 + installManPage docs/http.1 + ''; + + pytestFlagsArray = [ + "httpie" + "tests" + ]; + + pythonImportsCheck = [ + "httpie" + ]; + + meta = with lib; { + description = "A command line HTTP client whose goal is to make CLI human-friendly"; + homepage = "https://httpie.org/"; + license = licenses.bsd3; + maintainers = with maintainers; [ antono relrod schneefux SuperSandro2000 ]; + }; +} diff --git a/pkgs/tools/networking/httpie/default.nix b/pkgs/tools/networking/httpie/default.nix deleted file mode 100644 index 8590c85d2f3..00000000000 --- a/pkgs/tools/networking/httpie/default.nix +++ /dev/null @@ -1,74 +0,0 @@ -{ lib -, fetchFromGitHub -, installShellFiles -, python3 -, pandoc -}: - -python3.pkgs.buildPythonApplication rec { - pname = "httpie"; - version = "3.2.1"; - format = "setuptools"; - - src = fetchFromGitHub { - owner = "httpie"; - repo = "httpie"; - rev = version; - hash = "sha256-WEe8zSlNckl7bPBi6u8mHQ1/xPw3kE81F8Xr15TchgM="; - }; - - nativeBuildInputs = [ - installShellFiles - pandoc - ]; - - propagatedBuildInputs = with python3.pkgs; [ - charset-normalizer - defusedxml - multidict - pygments - requests - requests-toolbelt - setuptools - rich - pysocks - ]; - - checkInputs = with python3.pkgs; [ - pytest - pytest-httpbin - pytest-lazy-fixture - pytest-mock - pytestCheckHook - responses - werkzeug - ]; - - postInstall = '' - # install completions - installShellCompletion --bash \ - --name http.bash extras/httpie-completion.bash - installShellCompletion --fish \ - --name http.fish extras/httpie-completion.fish - - # convert the docs/README.md file - pandoc --standalone -f markdown -t man docs/README.md -o docs/http.1 - installManPage docs/http.1 - ''; - - pytestFlagsArray = [ - "httpie" - "tests" - ]; - - pythonImportsCheck = [ - "httpie" - ]; - - meta = with lib; { - description = "A command line HTTP client whose goal is to make CLI human-friendly"; - homepage = "https://httpie.org/"; - license = licenses.bsd3; - maintainers = with maintainers; [ antono relrod schneefux SuperSandro2000 ]; - }; -} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index e89aa5c04a8..3e8eafbe82c 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -6966,7 +6966,7 @@ with pkgs; httpdump = callPackage ../tools/security/httpdump { }; - httpie = callPackage ../tools/networking/httpie { }; + httpie = with python3Packages; toPythonApplication httpie; httping = callPackage ../tools/networking/httping {}; diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 44f7328c6f9..58e40073c70 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -3935,6 +3935,8 @@ in { httpcore = callPackage ../development/python-modules/httpcore { }; + httpie = callPackage ../development/python-modules/httpie { }; + http-ece = callPackage ../development/python-modules/http-ece { }; httplib2 = callPackage ../development/python-modules/httplib2 { }; -- cgit 1.4.1