1{ lib
2, beautifulsoup4
3, buildPythonPackage
4, pythonAtLeast
5, fetchFromGitHub
6, lxml
7, pytest-httpbin
8, pytest-mock
9, pytestCheckHook
10, requests
11, requests-mock
12}:
13
14buildPythonPackage rec {
15 pname = "mechanicalsoup";
16 version = "1.1.0";
17
18 disabled = ! pythonAtLeast "3.6";
19
20 src = fetchFromGitHub {
21 owner = "MechanicalSoup";
22 repo = "MechanicalSoup";
23 rev = "v${version}";
24 sha256 = "1mly0ivai3rx64frk7a7ra6abhdxm9x3l6s6x7sgrl9qx1z8zsp3";
25 };
26
27 propagatedBuildInputs = [
28 beautifulsoup4
29 lxml
30 requests
31 ];
32
33 checkInputs = [
34 pytest-httpbin
35 pytest-mock
36 pytestCheckHook
37 requests-mock
38 ];
39
40 postPatch = ''
41 # Is in setup_requires but not used in setup.py
42 substituteInPlace setup.py \
43 --replace "'pytest-runner'" ""
44 substituteInPlace setup.cfg \
45 --replace " --cov --cov-config .coveragerc --flake8" ""
46 '';
47
48 pythonImportsCheck = [ "mechanicalsoup" ];
49
50 meta = with lib; {
51 description = "Python library for automating interaction with websites";
52 homepage = "https://github.com/hickford/MechanicalSoup";
53 license = licenses.mit;
54 maintainers = with maintainers; [ jgillich fab ];
55 };
56}