2017-11-03 04:26:49 +01:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
2018-08-08 01:26:06 +02:00
|
|
|
, fetchPypi
|
2017-11-03 04:26:49 +01:00
|
|
|
, fetchFromGitHub
|
|
|
|
, buildPythonPackage
|
|
|
|
, geckodriver
|
2018-10-25 17:00:21 +02:00
|
|
|
, urllib3
|
2017-11-03 04:26:49 +01:00
|
|
|
, xorg
|
|
|
|
}:
|
|
|
|
|
2018-03-14 20:58:56 +01:00
|
|
|
|
|
|
|
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
|
|
|
|
|
2017-11-03 04:26:49 +01:00
|
|
|
buildPythonPackage rec {
|
2017-11-09 12:26:09 +01:00
|
|
|
pname = "selenium";
|
2018-10-25 17:00:21 +02:00
|
|
|
version = "3.14.1";
|
2017-11-09 12:26:09 +01:00
|
|
|
|
2018-08-08 01:26:06 +02:00
|
|
|
src = fetchPypi {
|
|
|
|
inherit pname version;
|
2018-10-25 17:00:21 +02:00
|
|
|
sha256 = "ab192cd046164c40fabcf44b47c66c8b12495142f4a69dcc55ea6eeef096e614";
|
2017-11-03 04:26:49 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
buildInputs = [xorg.libX11];
|
|
|
|
|
|
|
|
propagatedBuildInputs = [
|
2018-10-25 17:00:21 +02:00
|
|
|
geckodriver urllib3
|
2017-11-03 04:26:49 +01:00
|
|
|
];
|
|
|
|
|
2018-03-14 20:58:56 +01:00
|
|
|
patchPhase = stdenv.lib.optionalString stdenv.isLinux ''
|
2017-11-03 04:26:49 +01:00
|
|
|
cp "${x_ignore_nofocus}/cpp/linux-specific/"* .
|
|
|
|
substituteInPlace x_ignore_nofocus.c --replace "/usr/lib/libX11.so.6" "${xorg.libX11.out}/lib/libX11.so.6"
|
2018-03-14 20:58:56 +01:00
|
|
|
cc -c -fPIC x_ignore_nofocus.c -o x_ignore_nofocus.o
|
|
|
|
cc -shared \
|
2017-11-03 04:26:49 +01:00
|
|
|
-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"}/
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "The selenium package is used to automate web browser interaction from Python";
|
|
|
|
homepage = http://www.seleniumhq.org;
|
|
|
|
license = licenses.asl20;
|
|
|
|
maintainers = with maintainers; [ jraygauthier ];
|
|
|
|
};
|
2017-11-09 12:26:09 +01:00
|
|
|
}
|