From 4e4496ded139366e8aa92adc70d6ce3647a228f4 Mon Sep 17 00:00:00 2001 From: Nicolas Graves Date: Sat, 11 Oct 2025 18:46:35 +0200 Subject: gnu: python-selenium: Fix build and update package to 4.34.2. * gnu/packages/rust-crates.scm : Add selenium-manager crate sources record package. * gnu/packages/python-web.scm (selenium-manager): New variable. (python-selenium): Update to 4.34.2, inherit from selenium-manager. [arguments]<#:phases>: Add phases 'inject-selenium-manager-binary and 'relax-requirements. [inputs]: Add selenium-manager. [native-inputs]: Remove python-wheel. [decription]: Improve style. [source, home-page, license]: Inherit them. Fixes: guix/guix#3831 Change-Id: I88e2144e0c64472360072dac1a5fd03741a03975 Signed-off-by: Sharlatan Hellseher --- gnu/packages/python-web.scm | 70 ++++++++++++++++++++++++++++++++++++--------- 1 file changed, 56 insertions(+), 14 deletions(-) (limited to 'gnu/packages/python-web.scm') diff --git a/gnu/packages/python-web.scm b/gnu/packages/python-web.scm index 54022a24713..fdba733d6f2 100644 --- a/gnu/packages/python-web.scm +++ b/gnu/packages/python-web.scm @@ -9862,10 +9862,10 @@ Built on top of @code{asyncio}, Python's standard asynchronous I/O framework, it provides an elegant coroutine-based API.") (license license:bsd-3))) -(define-public python-selenium +(define-public selenium-manager (package - (name "python-selenium") - (version "4.28.1") + (name "selenium-manager") + (version "4.34.2") (source (origin (method git-fetch) @@ -9874,7 +9874,36 @@ it provides an elegant coroutine-based API.") (commit (string-append "selenium-" version "-python")))) (file-name (git-file-name name version)) (sha256 - (base32 "1q52qdd33wadxa8ir34kl5nxlrgjbqqk2yx2m1v5xxjf0agazjfl")))) + (base32 "14fg8r4rm9d7169rlm29l5yn08wgllmqk1zc6six3dlrzzf5mxil")))) + (build-system cargo-build-system) + (arguments + (list + ;; XXX: Almost all tests require either browsers or network access. + #:tests? #f + #:install-source? #f ; Most likely intended as a leaf. + #:phases + #~(modify-phases %standard-phases + (add-after 'unpack 'chdir + (lambda _ + (chdir "rust")))))) + (native-inputs (list pkg-config)) + (inputs (cons* (list zstd "lib") xz + (cargo-inputs 'selenium-manager))) + (home-page "https://www.selenium.dev") + (synopsis "CLI tool to manager the browser test infrastructure") + (description + "Selenium simplifies web browser automation. It specifically provides +infrastructure for the W3C WebDriver specification — a platform and +language-neutral coding interface compatible with all major web browsers. + +Selenium Manager is a CLI tool that automatically manages the browser/driver +infrastructure required by Selenium.") + (license license:asl2.0))) + +(define-public python-selenium + (package/inherit selenium-manager + (name "python-selenium") + (build-system pyproject-build-system) (arguments (list ;; XXX: Disable failing tests. @@ -9890,28 +9919,41 @@ it provides an elegant coroutine-based API.") #~(modify-phases %standard-phases (add-after 'unpack 'chdir (lambda _ - (chdir "py")))))) - (build-system pyproject-build-system) + (chdir "py"))) + (add-after 'chdir 'inject-selenium-manager-binary + (lambda* (#:key inputs #:allow-other-keys) + (substitute* "selenium/webdriver/common/selenium_manager.py" + (("compiled_path = Path.*") + (format #f "return Path(~s)~%" + (search-input-file inputs "bin/selenium-manager")))) + (substitute* "pyproject.toml" + (("\\[\\[tool\\.setuptools-rust\\.bins\\]\\]") + "") + (("target = \"selenium\\.webdriver\\.common.*\"") + "")))) + (add-after 'chdir 'relax-requirements + (lambda _ + (substitute* "pyproject.toml" + (("\"(typing_extensions|trio)~=.*\"," _ target) + (format #f "~s," target)))))))) (propagated-inputs (list python-certifi python-trio python-trio-websocket python-typing-extensions python-urllib3 python-websocket-client)) + (inputs (list selenium-manager)) (native-inputs (list python-filetype python-pytest python-pytest-mock python-pytest-trio python-setuptools - python-setuptools-rust - python-wheel)) - (home-page "https://www.selenium.dev") + python-setuptools-rust)) (synopsis "Python bindings for Selenium") - (description "Selenium enables web browser automation. -Selenium specifically provides infrastructure for the W3C WebDriver specification -— a platform and language-neutral coding interface compatible with all -major web browsers.") - (license license:asl2.0))) + (description + "Selenium enables web browser automation. It specifically provides +infrastructure for the W3C WebDriver specification — a platform and +language-neutral coding interface compatible with all major web browsers."))) (define-public python-rapidjson (package -- cgit v1.3