biome: 1.9.2 -> 1.9.3 (#349335)
[NixPkgs.git] / pkgs / development / python-modules / selenium / default.nix
blob72c9d14e9106d8d948f5e06d60031bc2a0870b2a
2   lib,
3   fetchFromGitHub,
4   buildPythonPackage,
5   selenium-manager,
6   certifi,
7   pytestCheckHook,
8   pythonOlder,
9   trio,
10   trio-websocket,
11   typing-extensions,
12   websocket-client,
13   urllib3,
14   pytest-trio,
15   nixosTests,
16   stdenv,
17   python,
20 buildPythonPackage rec {
21   pname = "selenium";
22   version = "4.24.0";
23   format = "setuptools";
25   disabled = pythonOlder "3.7";
27   src = fetchFromGitHub {
28     owner = "SeleniumHQ";
29     repo = "selenium";
30     # check if there is a newer tag with or without -python suffix
31     rev = "refs/tags/selenium-${version}";
32     hash = "sha256-AsQr9kGv2dxkiFzptDA0D27OXZjYj7oDKz2oEQ2qW7s=";
33   };
35   patches = [ ./dont-build-the-selenium-manager.patch ];
37   preConfigure = ''
38     cd py
39   '';
41   postInstall =
42     ''
43       DST_PREFIX=$out/${python.sitePackages}/selenium/webdriver/
44       DST_REMOTE=$DST_PREFIX/remote/
45       DST_FF=$DST_PREFIX/firefox
46       cp ../rb/lib/selenium/webdriver/atoms/getAttribute.js $DST_REMOTE
47       cp ../rb/lib/selenium/webdriver/atoms/isDisplayed.js $DST_REMOTE
48       cp ../rb/lib/selenium/webdriver/atoms/findElements.js $DST_REMOTE
49       cp ../javascript/cdp-support/mutation-listener.js $DST_REMOTE
50       cp ../third_party/js/selenium/webdriver.json $DST_FF/webdriver_prefs.json
51     ''
52     + lib.optionalString stdenv.hostPlatform.isDarwin ''
53       mkdir -p $DST_PREFIX/common/macos
54       ln -s ${lib.getExe selenium-manager} $DST_PREFIX/common/macos/
55     ''
56     + lib.optionalString stdenv.hostPlatform.isLinux ''
57       mkdir -p $DST_PREFIX/common/linux/
58       ln -s ${lib.getExe selenium-manager} $DST_PREFIX/common/linux/
59     '';
61   propagatedBuildInputs = [
62     certifi
63     trio
64     trio-websocket
65     urllib3
66     typing-extensions
67     websocket-client
68   ] ++ urllib3.optional-dependencies.socks;
70   nativeCheckInputs = [
71     pytestCheckHook
72     pytest-trio
73   ];
75   __darwinAllowLocalNetworking = true;
77   passthru.tests = {
78     testing-vaultwarden = nixosTests.vaultwarden;
79   };
81   meta = with lib; {
82     description = "Bindings for Selenium WebDriver";
83     homepage = "https://selenium.dev/";
84     license = licenses.asl20;
85     maintainers = with maintainers; [ jraygauthier ];
86   };