2021-02-05 17:12:51 +00:00
|
|
|
{ lib
|
2020-04-24 23:36:52 +00:00
|
|
|
, buildPythonPackage
|
|
|
|
, cssselect
|
2021-02-24 18:30:23 +00:00
|
|
|
, fetchPypi
|
2020-04-24 23:36:52 +00:00
|
|
|
, lxml
|
2023-02-02 18:25:31 +00:00
|
|
|
, pytestCheckHook
|
2024-01-13 08:15:51 +00:00
|
|
|
, pythonAtLeast
|
2021-02-24 18:30:23 +00:00
|
|
|
, pythonOlder
|
2023-02-02 18:25:31 +00:00
|
|
|
, requests
|
|
|
|
, webob
|
|
|
|
, webtest
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "pyquery";
|
2023-02-02 18:25:31 +00:00
|
|
|
version = "2.0.0";
|
|
|
|
disabled = pythonOlder "3.7";
|
|
|
|
|
|
|
|
format = "setuptools";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchPypi {
|
|
|
|
inherit pname version;
|
2023-02-02 18:25:31 +00:00
|
|
|
hash = "sha256-lj6NTpAmL/bY3sBy6pcoXcN0ovacrXd29AgqvPah2K4=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2023-04-29 16:46:19 +00:00
|
|
|
# https://github.com/gawel/pyquery/issues/248
|
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace tests/test_pyquery.py \
|
|
|
|
--replace test_selector_html skip_test_selector_html
|
|
|
|
'';
|
|
|
|
|
2021-02-24 18:30:23 +00:00
|
|
|
propagatedBuildInputs = [
|
|
|
|
cssselect
|
|
|
|
lxml
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-08-22 20:05:09 +00:00
|
|
|
__darwinAllowLocalNetworking = true;
|
|
|
|
|
2021-02-24 18:30:23 +00:00
|
|
|
pythonImportsCheck = [ "pyquery" ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
checkInputs = [
|
|
|
|
pytestCheckHook
|
|
|
|
requests
|
|
|
|
webob
|
|
|
|
(webtest.overridePythonAttrs (_: {
|
|
|
|
# circular dependency
|
|
|
|
doCheck = false;
|
|
|
|
}))
|
|
|
|
];
|
|
|
|
|
|
|
|
pytestFlagsArray = [
|
|
|
|
# requires network
|
|
|
|
"--deselect=tests/test_pyquery.py::TestWebScrappingEncoding::test_get"
|
|
|
|
];
|
|
|
|
|
2024-01-13 08:15:51 +00:00
|
|
|
disabledTests = lib.optionals (pythonAtLeast "3.12") [
|
|
|
|
# https://github.com/gawel/pyquery/issues/249
|
|
|
|
"pyquery.pyquery.PyQuery.serialize_dict"
|
|
|
|
];
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2021-02-24 18:30:23 +00:00
|
|
|
description = "A jquery-like library for Python";
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://github.com/gawel/pyquery";
|
2021-02-24 18:30:23 +00:00
|
|
|
changelog = "https://github.com/gawel/pyquery/blob/${version}/CHANGES.rst";
|
2020-04-24 23:36:52 +00:00
|
|
|
license = licenses.bsd0;
|
|
|
|
};
|
|
|
|
}
|