python310Packages.selenium: 3.141.0 -> 4.2.0

main
Sandro Jäckel 2 years ago committed by Jonathan Ringer
parent 2dce5a7204
commit 8466ac2820
No known key found for this signature in database
GPG Key ID: 5C841D3CFDFEC4E0
  1. 65
      pkgs/development/python-modules/selenium/default.nix

@ -1,59 +1,54 @@
{ lib
, stdenv
, fetchPypi
, fetchFromGitHub
, buildPythonPackage
, geckodriver
, pytestCheckHook
, pythonOlder
, trio
, trio-websocket
, urllib3
, xorg
, nixosTests
}:
let
# Recompiling x_ignore_nofocus.so as the original one dlopen's libX11.so.6 by some
# absolute paths. Replaced by relative path so it is found when used in nix.
x_ignore_nofocus =
fetchFromGitHub {
owner = "SeleniumHQ";
repo = "selenium";
rev = "selenium-3.6.0";
sha256 = "13wf4hx4i7nhl4s8xkziwxl0km1j873syrj4amragj6mpip2wn8v";
};
in
buildPythonPackage rec {
pname = "selenium";
version = "3.141.0";
src = fetchPypi {
inherit pname version;
sha256 = "039hf9knvl4s3hp21bzwsp1g5ri9gxsh504dp48lc6nr1av35byy";
version = "4.2.0";
disabled = pythonOlder "3.7";
src = fetchFromGitHub {
owner = "SeleniumHQ";
repo = "selenium";
rev = "selenium-${version}"; # check if there is a newer tag with -python suffix
sha256 = "sha256-KhBCMsWGRD7hJqumA1+K8AVhJ7hq26XkEa1QbgY0Q0w=";
};
buildInputs = [ xorg.libX11 ];
postPatch = ''
substituteInPlace py/selenium/webdriver/firefox/service.py \
--replace 'DEFAULT_EXECUTABLE_PATH = "geckodriver"' 'DEFAULT_EXECUTABLE_PATH = "${geckodriver}/bin/geckodriver"'
'';
preConfigure = ''
cd py
'';
propagatedBuildInputs = [
geckodriver urllib3
trio
trio-websocket
urllib3
] ++ urllib3.optional-dependencies.secure
++ urllib3.optional-dependencies.socks;
checkInputs = [
pytestCheckHook
];
postPatch = lib.optionalString stdenv.isLinux ''
cp "${x_ignore_nofocus}/cpp/linux-specific/"* .
substituteInPlace x_ignore_nofocus.c --replace "/usr/lib/libX11.so.6" "${lib.getLib xorg.libX11}/lib/libX11.so.6"
cc -c -fPIC x_ignore_nofocus.c -o x_ignore_nofocus.o
cc -shared \
-Wl,${if stdenv.isDarwin then "-install_name" else "-soname"},x_ignore_nofocus.so \
-o x_ignore_nofocus.so \
x_ignore_nofocus.o
cp -v x_ignore_nofocus.so selenium/webdriver/firefox/${if stdenv.is64bit then "amd64" else "x86"}/
'';
passthru.tests = {
testing-vaultwarden = nixosTests.vaultwarden;
};
meta = with lib; {
description = "The selenium package is used to automate web browser interaction from Python";
homepage = "http://www.seleniumhq.org";
description = "Bindings for Selenium WebDriver";
homepage = "https://selenium.dev/";
license = licenses.asl20;
maintainers = with maintainers; [ jraygauthier ];
};

Loading…
Cancel
Save