2019-09-23 14:56:01 +00:00
|
|
|
{ stdenv, fetchFromGitHub, python3Packages, docutils, }:
|
2012-12-28 22:28:34 +00:00
|
|
|
|
2019-09-20 08:04:18 +00:00
|
|
|
python3Packages.buildPythonApplication rec {
|
2019-08-30 03:02:24 +00:00
|
|
|
pname = "httpie";
|
2020-01-15 05:07:23 +00:00
|
|
|
version = "2.0.0";
|
2012-12-28 22:28:34 +00:00
|
|
|
|
2019-09-23 14:56:01 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "jakubroztocil";
|
|
|
|
repo = "httpie";
|
|
|
|
rev = version;
|
2020-01-15 05:07:23 +00:00
|
|
|
sha256 = "0d0rsn5i973l9y0ws3xmnzaw4jwxdlryyjbasnlddph5mvkf7dq0";
|
2012-12-28 22:28:34 +00:00
|
|
|
};
|
|
|
|
|
2020-03-01 23:44:35 +00:00
|
|
|
outputs = [ "out" "doc" "man" ];
|
|
|
|
|
2019-09-20 08:04:18 +00:00
|
|
|
propagatedBuildInputs = with python3Packages; [ pygments requests setuptools ];
|
2019-09-23 14:56:01 +00:00
|
|
|
dontUseSetuptoolsCheck = true;
|
2020-01-15 05:07:23 +00:00
|
|
|
patches = [ ./strip-venv.patch ];
|
2019-09-23 14:56:01 +00:00
|
|
|
|
|
|
|
checkInputs = with python3Packages; [
|
|
|
|
mock
|
|
|
|
pytest
|
|
|
|
pytest-httpbin
|
|
|
|
pytestCheckHook
|
|
|
|
];
|
|
|
|
|
2020-03-01 23:44:35 +00:00
|
|
|
postInstall = ''
|
2020-03-02 00:16:54 +00:00
|
|
|
# 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
|
|
|
|
|
2020-03-01 23:44:35 +00:00
|
|
|
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() {
|
|
|
|
${docutils}/bin/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
|
|
|
|
|
|
|
|
# change a few links to the local files
|
|
|
|
substituteInPlace $docdir/html/index.html \
|
|
|
|
--replace \
|
|
|
|
'https://github.com/jakubroztocil/httpie/blob/master/CHANGELOG.rst' \
|
|
|
|
"CHANGELOG.html" \
|
|
|
|
--replace \
|
|
|
|
'https://github.com/jakubroztocil/httpie/blob/master/CONTRIBUTING.rst' \
|
|
|
|
"CONTRIBUTING.html"
|
|
|
|
|
|
|
|
${docutils}/bin/rst2man \
|
|
|
|
--strip-elements-with-class=no-web \
|
|
|
|
--title=http \
|
|
|
|
--no-generator \
|
|
|
|
--no-datestamp \
|
|
|
|
--no-source-link \
|
|
|
|
README.rst \
|
|
|
|
$man/share/man/man1/http.1
|
|
|
|
'';
|
|
|
|
|
2019-09-23 14:56:01 +00:00
|
|
|
# the tests call rst2pseudoxml.py from docutils
|
|
|
|
preCheck = ''
|
|
|
|
export PATH=${docutils}/bin:$PATH
|
|
|
|
'';
|
2012-12-28 22:28:34 +00:00
|
|
|
|
|
|
|
meta = {
|
2012-12-28 23:09:01 +00:00
|
|
|
description = "A command line HTTP client whose goal is to make CLI human-friendly";
|
2017-08-02 21:50:51 +00:00
|
|
|
homepage = https://httpie.org/;
|
2014-05-08 20:34:19 +00:00
|
|
|
license = stdenv.lib.licenses.bsd3;
|
2016-12-11 12:17:49 +00:00
|
|
|
maintainers = with stdenv.lib.maintainers; [ antono relrod schneefux ];
|
2012-12-28 22:28:34 +00:00
|
|
|
};
|
|
|
|
}
|