depot/third_party/nixpkgs/pkgs/development/python-modules/selenium/default.nix
Default email ae2dc6aea6 Project import generated by Copybara.
GitOrigin-RevId: 4c2fcb090b1f3e5b47eaa7bd33913b574a11e0a0
2024-10-11 07:15:48 +02:00

87 lines
2.1 KiB
Nix

{
lib,
fetchFromGitHub,
buildPythonPackage,
selenium-manager,
certifi,
pytestCheckHook,
pythonOlder,
trio,
trio-websocket,
typing-extensions,
websocket-client,
urllib3,
pytest-trio,
nixosTests,
stdenv,
python,
}:
buildPythonPackage rec {
pname = "selenium";
version = "4.24.0";
format = "setuptools";
disabled = pythonOlder "3.7";
src = fetchFromGitHub {
owner = "SeleniumHQ";
repo = "selenium";
# check if there is a newer tag with or without -python suffix
rev = "refs/tags/selenium-${version}";
hash = "sha256-AsQr9kGv2dxkiFzptDA0D27OXZjYj7oDKz2oEQ2qW7s=";
};
patches = [ ./dont-build-the-selenium-manager.patch ];
preConfigure = ''
cd py
'';
postInstall =
''
DST_PREFIX=$out/${python.sitePackages}/selenium/webdriver/
DST_REMOTE=$DST_PREFIX/remote/
DST_FF=$DST_PREFIX/firefox
cp ../rb/lib/selenium/webdriver/atoms/getAttribute.js $DST_REMOTE
cp ../rb/lib/selenium/webdriver/atoms/isDisplayed.js $DST_REMOTE
cp ../rb/lib/selenium/webdriver/atoms/findElements.js $DST_REMOTE
cp ../javascript/cdp-support/mutation-listener.js $DST_REMOTE
cp ../third_party/js/selenium/webdriver.json $DST_FF/webdriver_prefs.json
''
+ lib.optionalString stdenv.hostPlatform.isDarwin ''
mkdir -p $DST_PREFIX/common/macos
ln -s ${lib.getExe selenium-manager} $DST_PREFIX/common/macos/
''
+ lib.optionalString stdenv.hostPlatform.isLinux ''
mkdir -p $DST_PREFIX/common/linux/
ln -s ${lib.getExe selenium-manager} $DST_PREFIX/common/linux/
'';
propagatedBuildInputs = [
certifi
trio
trio-websocket
urllib3
typing-extensions
websocket-client
] ++ urllib3.optional-dependencies.socks;
nativeCheckInputs = [
pytestCheckHook
pytest-trio
];
__darwinAllowLocalNetworking = true;
passthru.tests = {
testing-vaultwarden = nixosTests.vaultwarden;
};
meta = with lib; {
description = "Bindings for Selenium WebDriver";
homepage = "https://selenium.dev/";
license = licenses.asl20;
maintainers = with maintainers; [ jraygauthier ];
};
}