Skip to content

Commit

Permalink
http-prompt: refactor (#373210)
Browse files Browse the repository at this point in the history
  • Loading branch information
FliegendeWurst authored Jan 12, 2025
2 parents 5ee1b0b + 43de4a0 commit 2a5f8a8
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 58 deletions.
45 changes: 0 additions & 45 deletions pkgs/development/python-modules/prompt-toolkit/1.nix

This file was deleted.

68 changes: 55 additions & 13 deletions pkgs/tools/networking/http-prompt/default.nix
Original file line number Diff line number Diff line change
@@ -1,41 +1,83 @@
{
lib,
fetchFromGitHub,
python3Packages,
python3,
httpie,
versionCheckHook,
}:

python3Packages.buildPythonApplication rec {
let
python = python3.override {
self = python;
packageOverrides = _: super: {
prompt-toolkit = super.prompt-toolkit.overridePythonAttrs (old: rec {
version = "1.0.18";
src = old.src.override {
inherit version;
hash = "sha256-3U/KAsgGlJetkxotCZFMaw0bUBUc6Ha8Fb3kx0cJASY=";
};
});
};
};
in
python.pkgs.buildPythonApplication rec {
pname = "http-prompt";
version = "2.1.0";
pyproject = true;

src = fetchFromGitHub {
rev = "v${version}";
tag = "v${version}";
repo = "http-prompt";
owner = "httpie";
sha256 = "sha256-e4GyuxCeXYNsnBXyjIJz1HqSrqTGan0N3wxUFS+Hvkw=";
hash = "sha256-e4GyuxCeXYNsnBXyjIJz1HqSrqTGan0N3wxUFS+Hvkw=";
};

propagatedBuildInputs = with python3Packages; [
build-system = [ python.pkgs.setuptools ];

dependencies = with python.pkgs; [
click
httpie
parsimonious
(python.pkgs.callPackage ../../../development/python-modules/prompt-toolkit/1.nix { })
prompt-toolkit
pygments
six
pyyaml
];

checkPhase = ''
$out/bin/${pname} --version | grep -q "${version}"
'';
pythonImportsCheck = [ "http_prompt" ];

nativeCheckInputs = [
python.pkgs.mock
python.pkgs.pexpect
python.pkgs.pytest-cov-stub
python.pkgs.pytestCheckHook
versionCheckHook
];

disabledTests = [
# require network access
"test_get_and_tee"
"test_get_image"
"test_get_querystring"
"test_post_form"
"test_post_json"
"test_spec_from_http"
"test_spec_from_http_only"
# executable path is hardcoded
"test_help"
"test_interaction"
"test_version"
"test_vi_mode"
];

versionCheckProgramArg = [ "--version" ];

meta = with lib; {
meta = {
description = "Interactive command-line HTTP client featuring autocomplete and syntax highlighting";
mainProgram = "http-prompt";
homepage = "https://github.com/eliangcs/http-prompt";
license = licenses.mit;
maintainers = with maintainers; [ matthiasbeyer ];
platforms = platforms.linux ++ platforms.darwin;
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ matthiasbeyer ];
platforms = lib.platforms.linux ++ lib.platforms.darwin;
};
}

0 comments on commit 2a5f8a8

Please sign in to comment.