http-prompt: refactor (#373210)

Arne Keller 2a5f8a89 5ee1b0bc

Changed files
+55 -58
pkgs
development
python-modules
prompt-toolkit
tools
networking
http-prompt
-45
pkgs/development/python-modules/prompt-toolkit/1.nix
···
-
{
-
lib,
-
buildPythonPackage,
-
fetchPypi,
-
pytestCheckHook,
-
docopt,
-
six,
-
wcwidth,
-
pygments,
-
}:
-
-
buildPythonPackage rec {
-
pname = "prompt-toolkit";
-
version = "1.0.18";
-
-
src = fetchPypi {
-
pname = "prompt_toolkit";
-
inherit version;
-
sha256 = "dd4fca02c8069497ad931a2d09914c6b0d1b50151ce876bc15bde4c747090126";
-
};
-
-
propagatedBuildInputs = [
-
docopt
-
six
-
wcwidth
-
pygments
-
];
-
-
nativeCheckInputs = [ pytestCheckHook ];
-
-
disabledTests = [ "test_pathcompleter_can_expanduser" ];
-
-
meta = with lib; {
-
description = "Python library for building powerful interactive command lines";
-
longDescription = ''
-
prompt_toolkit could be a replacement for readline, but it can be
-
much more than that. It is cross-platform, everything that you build
-
with it should run fine on both Unix and Windows systems. Also ships
-
with a nice interactive Python shell (called ptpython) built on top.
-
'';
-
homepage = "https://github.com/jonathanslenders/python-prompt-toolkit";
-
maintainers = [ ];
-
license = licenses.bsd3;
-
};
-
}
+55 -13
pkgs/tools/networking/http-prompt/default.nix
···
{
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" ];
-
meta = with lib; {
+
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 = {
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;
};
}