orweis / winpcapy

A Modern Python wrapper for WinPcap
GNU General Public License v2.0
76 stars 23 forks source link

tweak to support cygwin #11

Closed a6 closed 7 years ago

a6 commented 7 years ago

cygwin systems return 'cygwin' for sys.platform, which does not start with 'win', and the test was failing

orweis commented 7 years ago

First, thank you for contributing. Second- the solution for checking for "win" in the string, will be a problem for macOs where the string will include the string 'Darwin'. https://stackoverflow.com/questions/16721940/why-when-use-sys-platform-on-mac-os-it-print-darwin

It would be better to add a specific case for cygwin- e.g. if sys.platform.startswith('win') or 'cygwin' in sys.platform

or even better use a cleaner solution: import platform platform.system() == 'Windows'

Would you like to take a swing at it? (If not I'll add it myself later)

a6 commented 7 years ago

Good point, I didn't consider what Macs return. The problem with cygwin is still present for platform.system() as that returns 'CGWIN_NT-6.1' on Windows systems. I'll just submit a PR for the and condition. Thanks!