shadowmoose / pyderman

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

mac m2 not recognized by pyderman #30

Closed MarcelWilson closed 1 year ago

MarcelWilson commented 1 year ago

sysctl -n machdep.cpu.brand_string on a Mac m2 chip returns the following: Apple M2 Pro

This results in pyderman pulling the intel version of chromedriver https://chromedriver.storage.googleapis.com/113.0.5672.63/chromedriver_mac64.zip rather than the expected url: https://chromedriver.storage.googleapis.com/113.0.5672.63/chromedriver_mac_arm64.zip

MarcelWilson commented 1 year ago

I was looking at possible solutions to this and I'm thinking it might be possible to differentiate between intel and arm without having to resort to using subprocess call sysctl -n machdep.cpu.brand_string

I believe it could be possible to use platform.processor() which (afaik) would return arm or i386 platform.machine() also returns either arm64 or x86_64

MarcelWilson commented 1 year ago

While creating a branch for this issue I noticed that trying to run the tests does not work on a mac m1/m2.
TestDriverInstalls.test_opera & TestDriverInstalls.test_phantomjs assume install is possible for mac-m1.

I'm adding some additional coverage for just the get_url portions of each driver, but I'm not exactly sure what needs to be done about the two tests above not running in all environments.

My hunch is when on apple silicon, if the driver group does not offer an arm version of the driver, assume downloading the intel driver will work.

MarcelWilson commented 1 year ago

I also noticed the github action for macOS (10.15) was removed 8/30/22.

shadowmoose commented 1 year ago

Good catch. Mac compatibility is difficult for me to work around, as I do not use or own one myself. Any help there is appreciated.

I'm unsure how to treat the unit testing. On one hand, it's easy enough to add a few @unittest.skipIf annotations and skip in the wrong environments. On the other hand, technically the total compatibility isn't there if the drivers are missing for the platform. There's nothing that this project can do about those however, so it's probably not useful to keep the erroring tests running - even as a warning about their absence.

MarcelWilson commented 1 year ago

I submitted #31. It handles the mac arm vs intel issue. I had to add a few cases in unittests which had me going down the rabbit hole for a little bit. I'm noting some of the more interesting points in the PR notes just because there are a bunch of commits.

bandophahita commented 1 year ago

31 was merged. This issue can be closed.