WIP - DO NOT MERGE
🔗 Related Issues
#15801
💥 What does this PR do?
Work is being done towards supporting ARM binaries for Selenium Manager (see: #15801, #16045, #16046). Once we begin publishing ARM64 binaries for Windows and Linux, the bindings will need to be updated to select the correct binary at runtime based on architecture.
This PR contains the updates to Python packaging and the Python bindings code to support this change.
💡 Additional Considerations
This PR assumes we are building/publishing new binaries named selenium-manager-arm64 (Linux) and selenium-manager-arm64.exe (Windows). It will need to be adapted to reflect whatever names are actually used when the work is done.
🔄 Types of changes
- Build/Packaging
- New feature
PR Type
Enhancement
Description
-
Add ARM64 binary support for Selenium Manager
-
Update binary selection logic for architecture detection
-
Modify build configuration for ARM64 binaries
-
Update packaging to include ARM64 executables
Changes diagram
flowchart LR
A["Platform Detection"] --> B["Architecture Check"]
B --> C["Binary Selection"]
C --> D["ARM64 Binary"]
C --> E["x86_64 Binary"]
F["Build System"] --> G["Package ARM64 Binaries"]
Changes walkthrough 📝
| Relevant files |
|---|
| Enhancement |
selenium_manager.pyARM64 binary selection logic implementation
py/selenium/webdriver/common/selenium_manager.py
Enhanced binary selection logic to support ARM64 architecture Added platform-specific ARM64 binary paths for Windows and Linux Updated architecture detection to use platform.machine().lower() Extended allowed binary mappings for ARM64 support
|
+9/-3 |
|
| Configuration changes |
BUILD.bazelBuild configuration for ARM64 binaries
py/BUILD.bazel
Added copy rules for ARM64 Selenium Manager binaries Created manager-linux-arm64 and manager-windows-arm64 targets Updated build configuration to include ARM64 executables
|
+12/-0 |
pyproject.tomlPackage data configuration for ARM64
py/pyproject.toml
Added ARM64 binary files to package data Included selenium-manager-arm64 and selenium-manager-arm64.exe Updated packaging configuration for ARM64 support
|
+2/-0 |
|
Need help?
Type /help how to ... in the comments thread for any questions about Qodo Merge usage.Check out the documentation for more information.
PR Reviewer Guide 🔍
Here are some key observations to aid the review process:
| ⏱️ Estimated effort to review: 3 🔵🔵🔵⚪⚪ |
| 🧪 No relevant tests |
| 🔒 No security concerns identified |
⚡ Recommended focus areas for review
Architecture Mapping
The architecture detection logic maps platform.machine() output to binary names, but ARM64 architectures can have different identifiers (aarch64, arm64, etc.). The current implementation only checks for 'arm64' which may not cover all ARM64 variants returned by platform.machine().
arch = "any" if sys.platform == "darwin" else platform.machine().lower()
if sys.platform in ["freebsd", "openbsd"]:
logger.warning("Selenium Manager binary may not be compatible with %s; verify settings", sys.platform)
location = allowed.get((sys.platform, arch))
Missing Fallback
The code removes the fallback mechanism for Windows platforms that previously used 'any' architecture. If ARM64 detection fails or returns an unexpected value, there's no fallback to the standard x86_64 binary, which could cause runtime failures.
("win32", "amd64"): "windows/selenium-manager.exe",
("win32", "arm64"): "windows/selenium-manager-arm64.exe",
("cygwin", "amd64"): "windows/selenium-manager.exe",
("cygwin", "arm64"): "windows/selenium-manager-arm64.exe",
("linux", "x86_64"): "linux/selenium-manager",
("linux", "arm64"): "linux/selenium-manager-arm64",
("freebsd", "x86_64"): "linux/selenium-manager",
("freebsd", "arm64"): "linux/selenium-manager-arm64",
("openbsd", "x86_64"): "linux/selenium-manager",
("openbsd", "arm64"): "linux/selenium-manager-arm64",
}
arch = "any" if sys.platform == "darwin" else platform.machine().lower()
if sys.platform in ["freebsd", "openbsd"]:
logger.warning("Selenium Manager binary may not be compatible with %s; verify settings", sys.platform)
location = allowed.get((sys.platform, arch))
|
PR Code Suggestions ✨
Explore these optional code suggestions:
| Category | Suggestion | Impact |
| Possible issue |
Normalize architecture detection values
The architecture detection may fail on some systems where platform.machine() returns unexpected values. Add architecture normalization to handle common ARM64 variants like 'aarch64' and 'arm64'.
py/selenium/webdriver/common/selenium_manager.py [93]
arch = "any" if sys.platform == "darwin" else platform.machine().lower()
+# Normalize ARM64 architecture names
+if arch in ("aarch64", "arm64"):
+ arch = "arm64"
+elif arch in ("x86_64", "amd64"):
+ arch = "amd64" if sys.platform.startswith("win") else "x86_64"
- [ ] Apply / Chat <!-- /improve --apply_suggestion=0 -->
Suggestion importance[1-10]: 7
__
Why: The suggestion correctly identifies that platform.machine() can return different values for the same architecture (e.g., aarch64 vs arm64), and the proposed normalization makes the implementation more robust.
| Medium
|
- [ ] More <!-- /improve --more_suggestions=true -->
| |
Something has been changed? Should I be aware?..
Something has been changed? Should I be aware?..
No, I have a script that syncs my fork's branches with the main repo.. it triggers CI every time I update. I'll see if I can fix it so I don't do so many unnecessary merges in a branch with no changes.
Is creating a huge hard coded list the best way to do this? (curious how painful the other bindings will be)
Is creating a huge hard coded list the best way to do this? (curious how painful the other bindings will be)
I just refactored the way it chooses the binary name and location so it's more flexible and we don't have to hard code a big list.
But it still has to go through some kind of nasty conditional logic to figure out the binary name:
-
selenium-manager
-
selenium-manager.exe
-
selenium-manager-arm64
-
selenium-manager-arm64.exe
and the directory it's in: