shadowmoose / pyderman

Install Selenium-compatible Chrome/Firefox/Opera/PhantomJS/Edge webdrivers automatically.
MIT License
29 stars 11 forks source link

detect difference between architectures when determining if driver is already found #33

Open bandophahita opened 1 year ago

bandophahita commented 1 year ago

This is likely only really an issue on the new apple silicon macs but it could pertain to folks running docker and downloading the webdriver to a shared volume between the host machine and the container (I'm guessing it's a pretty rare edge case)

When pyderman checks to see if the file_path already exists it doesn't do a check between the file architectures. While it is possible for chromedriver compiled for amd64 to run on an m1/m2 mac, the arm64 version really ought to be used.

In theory, we should determine if the existing file is in the "proper" architecture when deciding to overwrite the file or not.

bandophahita commented 1 year ago

Doing some napkin logic -

Assuming user has ARM cpu

In Scenario 2 it's possible to install an ARM version of the driver via the Debian package manager (apt-get) even though the chromedriver group doesn't compile an ARM driver for linux. As I understand it the Debian group compiles their own.

Due to the above situation I'm not sure what the right thing to do here:

My gut says the right thing to do would be to raise an exception letting the user know we can't help them. They have something pyderman couldn't update for them.

It's also unclear to me if we would also need a way to force the download of the webdriver in a specific architecture (where possible). Say if someone specifically wanted to pull down x86 even though they were on ARM.

bandophahita commented 1 year ago

Potential gotchas:

Architecture not always available for all versions?

For the most recent versions of the drivers I've looked at, it would seem the driver groups are consistent with their offerings. That wasn't the case with earlier versions. ARM wasn't really something folks bothered to compile until apple moved to their new silicon.

Architecture not available for all OSes

It seems that most of the webdrivers compile a mac arm version but that's not the case for linux and certainly not the case for windows.

Architecture not available for all webdrivers

Opera does not appear to compile a separate driver for apple silicon.

shadowmoose commented 1 year ago

This is interesting, but I worry about the platform-specific solutions that would be necessary to support all the possible situations. I'm not opposed to adding this level of support, but I probably won't have time to dig into this myself.