httpie: 2.4.0 -> 2.5.0

This commit is contained in:
Fabian Affolter 2021-09-27 12:40:29 +02:00
parent 7b03c7ee60
commit d3a174415c

View File

@ -1,88 +1,67 @@
{ lib, fetchFromGitHub, python3Packages, docutils }:
{ lib
, fetchFromGitHub
, installShellFiles
, python3Packages
, pandoc
}:
python3Packages.buildPythonApplication rec {
pname = "httpie";
version = "2.4.0";
version = "2.5.0";
src = fetchFromGitHub {
owner = "httpie";
repo = "httpie";
rev = version;
sha256 = "00lafjqg9nfnak0nhcr2l2hzzkwn2y6qv0wdkm6r6f69snizy3hf";
sha256 = "sha256-GwwZLXf9CH024gKfWsYPnr/oqQcxR/lQIToFRh59B+E=";
};
patches = [
./strip-venv.patch
nativeBuildInputs = [
installShellFiles
pandoc
];
outputs = [ "out" "doc" "man" ];
nativeBuildInputs = [ docutils ];
propagatedBuildInputs = with python3Packages; [ pygments requests requests-toolbelt setuptools ];
propagatedBuildInputs = with python3Packages; [
defusedxml
pygments
requests
requests-toolbelt
setuptools
];
checkInputs = with python3Packages; [
mock
pytest
pytest-httpbin
pytestCheckHook
responses
];
postInstall = ''
# install completions
install -Dm555 \
extras/httpie-completion.bash \
$out/share/bash-completion/completions/http.bash
install -Dm555 \
extras/httpie-completion.fish \
$out/share/fish/vendor_completions.d/http.fish
installShellCompletion --bash \
--name http.bash extras/httpie-completion.bash
installShellCompletion --fish \
--name http.fish extras/httpie-completion.fish
mkdir -p $man/share/man/man1
docdir=$doc/share/doc/httpie
mkdir -p $docdir/html
cp AUTHORS.rst CHANGELOG.rst CONTRIBUTING.rst $docdir
# helpfully, the readme has a `no-web` class to exclude
# the parts that are not relevant for offline docs
# this one build link was not marked however
sed -e 's/^|build|//g' -i README.rst
toHtml() {
rst2html5 \
--strip-elements-with-class=no-web \
--title=http \
--no-generator \
--no-datestamp \
--no-source-link \
"$1" \
"$2"
}
toHtml README.rst $docdir/html/index.html
toHtml CHANGELOG.rst $docdir/html/CHANGELOG.html
toHtml CONTRIBUTING.rst $docdir/html/CONTRIBUTING.html
rst2man \
--strip-elements-with-class=no-web \
--title=http \
--no-generator \
--no-datestamp \
--no-source-link \
README.rst \
$man/share/man/man1/http.1
# convert the docs/README.md file
pandoc --standalone -f markdown -t man docs/README.md -o docs/http.1
installManPage docs/http.1
'';
# the tests call rst2pseudoxml.py from docutils
preCheck = ''
export PATH=${docutils}/bin:$PATH
'';
pytestFlagsArray = [
"httpie"
"tests"
];
checkPhase = ''
py.test ./httpie ./tests --doctest-modules --verbose ./httpie ./tests -k 'not test_chunked and not test_verbose_chunked and not test_multipart_chunked and not test_request_body_from_file_by_path_chunked'
'';
disabledTests = [
"test_chunked"
"test_verbose_chunked"
"test_multipart_chunked"
"test_request_body_from_file_by_path_chunked"
];
pythonImportsCheck = [ "httpie" ];
meta = with lib; {
description = "A command line HTTP client whose goal is to make CLI human-friendly";