nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 125 lines 3.2 kB view raw
1{ 2 lib, 3 fetchFromGitHub, 4 buildPythonPackage, 5 selenium-manager, 6 setuptools, 7 certifi, 8 pytestCheckHook, 9 trio, 10 trio-typing, 11 trio-websocket, 12 typing-extensions, 13 websocket-client, 14 urllib3, 15 filetype, 16 pytest-mock, 17 pytest-trio, 18 rich, 19 nixosTests, 20 stdenv, 21 python, 22}: 23 24buildPythonPackage rec { 25 pname = "selenium"; 26 version = "4.40.0"; 27 pyproject = true; 28 29 src = fetchFromGitHub { 30 owner = "SeleniumHQ"; 31 repo = "selenium"; 32 tag = "selenium-${version}" + lib.optionalString (lib.versions.patch version != "0") "-python"; 33 hash = "sha256-Yfm2kpAmmEUP+m48PQf09UvFPeGBxd0ukqTtVah5h+E="; 34 }; 35 36 patches = [ ./dont-build-the-selenium-manager.patch ]; 37 38 preConfigure = '' 39 cd py 40 ''; 41 42 postInstall = '' 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 find $out/${python.sitePackages}/ 53 '' 54 + lib.optionalString stdenv.hostPlatform.isDarwin '' 55 mkdir -p $DST_PREFIX/common/macos 56 ln -s ${lib.getExe selenium-manager} $DST_PREFIX/common/macos/ 57 '' 58 + lib.optionalString stdenv.hostPlatform.isLinux '' 59 mkdir -p $DST_PREFIX/common/linux/ 60 ln -s ${lib.getExe selenium-manager} $DST_PREFIX/common/linux/ 61 ''; 62 63 build-system = [ setuptools ]; 64 65 dependencies = [ 66 certifi 67 trio 68 trio-typing 69 trio-websocket 70 typing-extensions 71 urllib3 72 websocket-client 73 ] 74 ++ urllib3.optional-dependencies.socks; 75 76 pythonRemoveDeps = [ 77 "types-certifi" 78 "types-urllib3" 79 ]; 80 81 nativeCheckInputs = [ 82 filetype 83 pytestCheckHook 84 pytest-mock 85 pytest-trio 86 rich 87 ]; 88 89 disabledTestPaths = [ 90 # ERROR without error context 91 "test/selenium/webdriver/common/bidi_webextension_tests.py" 92 "test/selenium/webdriver/firefox/ff_installs_addons_tests.py" 93 # Fails to find browsers during test phase 94 "test/selenium" 95 ] 96 ++ lib.optionals (stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isAarch64) [ 97 # Unsupported platform/architecture combination: linux/aarch64 98 "test/unit/selenium/webdriver/common/selenium_manager_tests.py::test_errors_if_not_file" 99 ]; 100 101 disabledTests = [ 102 # Fails to find data that is only copied into out in postInstall 103 "test_missing_cdp_devtools_version_falls_back" 104 "test_uses_windows" 105 "test_uses_linux" 106 "test_uses_mac" 107 "test_set_profile_with_firefox_profile" 108 "test_set_profile_with_path" 109 "test_creates_capabilities" 110 "test_get_connection_manager_for_certs_and_timeout" 111 ]; 112 113 __darwinAllowLocalNetworking = true; 114 115 passthru.tests = { 116 testing-vaultwarden = nixosTests.vaultwarden; 117 }; 118 119 meta = { 120 description = "Bindings for Selenium WebDriver"; 121 homepage = "https://selenium.dev/"; 122 license = lib.licenses.asl20; 123 maintainers = with lib.maintainers; [ jraygauthier ]; 124 }; 125}