/usr/lib/cmake/paraview/FindSeleniumDrivers.cmake is in paraview-dev 5.0.1+dfsg1-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | # - Try to find the Selenium browser drivers
# Once run, this macro will define the following
#
# CHROMEDRIVER_EXECUTABLE
# FIREFOXDRIVER_EXTENSION
# IEDRIVER_EXECUTABLE
# SAFARIDRIVER_EXTENSION
# This is a standard find, as the chromedriver executable is an
# external program on the system
find_program(CHROMEDRIVER_EXECUTABLE
NAMES chromedriver
PATHS CHROMEDRIVER_HOME ENV PATH
PATH_SUFFIXES chromedriver bin chromedriver/bin
)
# Now check if the firefox selenium driver extension is available
set(DO_FIREFOX_DRIVER_EXTENSION_CHECK FALSE)
# The execute_process which runs python to check for the presence of
# the firefox webdriver should only be run if either the
# FIREFOXDRIVER_EXTENSION variable is not yet defined or if it came
# up NOTFOUND in the past. Because CMake does not seem to do short-
# circuit evaluation, we have to do this check in multiple steps.
if(NOT DEFINED FIREFOXDRIVER_EXTENSION)
set(DO_FIREFOX_DRIVER_EXTENSION_CHECK TRUE)
endif()
if(NOT ${DO_FIREFOX_DRIVER_EXTENSION_CHECK})
if(${FIREFOXDRIVER_EXTENSION} MATCHES "NOTFOUND")
set(DO_FIREFOX_DRIVER_EXTENSION_CHECK TRUE)
endif()
endif()
if(${DO_FIREFOX_DRIVER_EXTENSION_CHECK})
# The selenium firefox driver is not an external program, but rather
# a Firefox extension. This approach to finding the firefox selenium
# webdriver seems to work, but it pops up a browser window, which is
# less than desirable. Improving this is something we will have to
# think about in the future.
execute_process(COMMAND ${PYTHON_EXECUTABLE}
-c
"
import os
try :
import selenium
from selenium import webdriver
browser = webdriver.Firefox()
browser.quit()
except :
os._exit(0)
os._exit(1)
"
RESULT_VARIABLE HAS_FIREFOXDRIVER_EXTENSION)
if("1" STREQUAL ${HAS_FIREFOXDRIVER_EXTENSION})
set(FIREFOX_EXT_VALUE "FIREFOXDRIVER_EXTENSION-FOUND")
else()
set(FIREFOX_EXT_VALUE "FIREFOXDRIVER_EXTENSION-NOTFOUND")
endif()
set(FIREFOXDRIVER_EXTENSION
${FIREFOX_EXT_VALUE}
CACHE
STRING
"The location or presence of the Selenium Firefox driver extension"
FORCE)
endif()
# TODO: Actually find these things
set(IEDRIVER_EXECUTABLE
"IEDRIVER_EXECUTABLE-NOTFOUND"
CACHE
STRING
"The location of the Selenium Internet Explorer driver executable")
set(SAFARIDRIVER_EXTENSION
"SAFARIDRIVER_EXTENSION-NOTFOUND"
CACHE
STRING
"The location or presence of the Selenium Safari driver executable")
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(SeleniumDrivers
DEFAULT_MSG
CHROMEDRIVER_EXECUTABLE
FIREFOXDRIVER_EXTENSION
IEDRIVER_EXECUTABLE
SAFARIDRIVER_EXTENSION )
mark_as_advanced(CHROMEDRIVER_EXECUTABLE)
mark_as_advanced(FIREFOXDRIVER_EXTENSION)
mark_as_advanced(IEDRIVER_EXECUTABLE)
mark_as_advanced(SAFARIDRIVER_EXTENSION)
|