2021-02-05 17:12:51 +00:00
|
|
|
{ lib
|
|
|
|
, backoff
|
|
|
|
, buildPythonPackage
|
|
|
|
, fetchFromGitHub
|
2021-08-25 08:27:29 +00:00
|
|
|
, importlib-metadata
|
2021-07-14 22:03:04 +00:00
|
|
|
, parameterized
|
2021-08-25 08:27:29 +00:00
|
|
|
, poetry-core
|
2021-02-05 17:12:51 +00:00
|
|
|
, pytestCheckHook
|
2021-07-14 22:03:04 +00:00
|
|
|
, pythonOlder
|
2021-02-05 17:12:51 +00:00
|
|
|
, requests
|
|
|
|
, requests-mock
|
2021-07-14 22:03:04 +00:00
|
|
|
, responses
|
|
|
|
, rich
|
2021-02-05 17:12:51 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "censys";
|
2021-08-27 14:25:00 +00:00
|
|
|
version = "2.0.6";
|
2021-08-25 08:27:29 +00:00
|
|
|
format = "pyproject";
|
|
|
|
|
2021-07-14 22:03:04 +00:00
|
|
|
disabled = pythonOlder "3.6";
|
2021-02-05 17:12:51 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "censys";
|
|
|
|
repo = "censys-python";
|
2021-07-14 22:03:04 +00:00
|
|
|
rev = "v${version}";
|
2021-08-27 14:25:00 +00:00
|
|
|
sha256 = "sha256-Lbd2Pm79n0cFoGHC2rucxgZijzcVYVJJsq1yzqB9QLk=";
|
2021-02-05 17:12:51 +00:00
|
|
|
};
|
|
|
|
|
2021-08-25 08:27:29 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
poetry-core
|
|
|
|
];
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
propagatedBuildInputs = [
|
|
|
|
backoff
|
|
|
|
requests
|
2021-07-14 22:03:04 +00:00
|
|
|
rich
|
2021-08-25 08:27:29 +00:00
|
|
|
] ++ lib.optionals (pythonOlder "3.8") [
|
|
|
|
importlib-metadata
|
2021-02-05 17:12:51 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
checkInputs = [
|
2021-07-14 22:03:04 +00:00
|
|
|
parameterized
|
2021-02-05 17:12:51 +00:00
|
|
|
pytestCheckHook
|
|
|
|
requests-mock
|
2021-07-14 22:03:04 +00:00
|
|
|
responses
|
2021-02-05 17:12:51 +00:00
|
|
|
];
|
|
|
|
|
2021-07-14 22:03:04 +00:00
|
|
|
postPatch = ''
|
2021-08-25 08:27:29 +00:00
|
|
|
substituteInPlace pyproject.toml \
|
|
|
|
--replace 'backoff = "^1.11.1"' 'backoff = "*"' \
|
|
|
|
--replace 'requests = ">=2.26.0"' 'requests = "*"' \
|
|
|
|
--replace 'rich = "^10.6.0"' 'rich = "*"'
|
2021-08-27 14:25:00 +00:00
|
|
|
substituteInPlace pytest.ini \
|
|
|
|
--replace "--cov" ""
|
2021-07-14 22:03:04 +00:00
|
|
|
'';
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
# The tests want to write a configuration file
|
|
|
|
preCheck = ''
|
|
|
|
export HOME=$(mktemp -d)
|
|
|
|
mkdir -p $HOME
|
2021-07-14 22:03:04 +00:00
|
|
|
'';
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
pythonImportsCheck = [ "censys" ];
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Python API wrapper for the Censys Search Engine (censys.io)";
|
|
|
|
homepage = "https://github.com/censys/censys-python";
|
|
|
|
license = with licenses; [ asl20 ];
|
2021-07-14 22:03:04 +00:00
|
|
|
maintainers = with maintainers; [ fab ];
|
2021-02-05 17:12:51 +00:00
|
|
|
};
|
|
|
|
}
|