1{ lib 2, stdenv 3, fetchurl 4, fetchFromGitHub 5, buildPythonPackage 6, geckodriver 7, xorg 8}: 9 10buildPythonPackage rec { 11 pname = "selenium"; 12 version = "3.6.0"; 13 name = pname + "-" + version; 14 15 src = fetchurl { 16 url = "mirror://pypi/s/selenium/${name}.tar.gz"; 17 sha256 = "15qpvz0bdwjvpcj11fm0rw6r5inr66sqw89ww50l025sbhf04qwm"; 18 }; 19 20 buildInputs = [xorg.libX11]; 21 22 propagatedBuildInputs = [ 23 geckodriver 24 ]; 25 26 # Recompiling x_ignore_nofocus.so as the original one dlopen's libX11.so.6 by some 27 # absolute paths. Replaced by relative path so it is found when used in nix. 28 x_ignore_nofocus = 29 fetchFromGitHub { 30 owner = "SeleniumHQ"; 31 repo = "selenium"; 32 rev = "selenium-3.6.0"; 33 sha256 = "13wf4hx4i7nhl4s8xkziwxl0km1j873syrj4amragj6mpip2wn8v"; 34 }; 35 36 patchPhase = '' 37 cp "${x_ignore_nofocus}/cpp/linux-specific/"* . 38 substituteInPlace x_ignore_nofocus.c --replace "/usr/lib/libX11.so.6" "${xorg.libX11.out}/lib/libX11.so.6" 39 gcc -c -fPIC x_ignore_nofocus.c -o x_ignore_nofocus.o 40 gcc -shared \ 41 -Wl,${if stdenv.isDarwin then "-install_name" else "-soname"},x_ignore_nofocus.so \ 42 -o x_ignore_nofocus.so \ 43 x_ignore_nofocus.o 44 cp -v x_ignore_nofocus.so selenium/webdriver/firefox/${if stdenv.is64bit then "amd64" else "x86"}/ 45 ''; 46 47 meta = with lib; { 48 description = "The selenium package is used to automate web browser interaction from Python"; 49 homepage = http://www.seleniumhq.org; 50 license = licenses.asl20; 51 maintainers = with maintainers; [ jraygauthier ]; 52 }; 53}