weecology / retriever

Quickly download, clean up, and install public datasets into a database management system
http://data-retriever.org
Other
306 stars 134 forks source link

Fix Windows check to deal with Darwin OS X release #314

Closed ethanwhite closed 9 years ago

ethanwhite commented 9 years ago

We need to check if the retriever is running on Windows for a couple of reasons. This has been done using something like

if 'win' in platform.platform().lower()

This was working great until the newest OS X release which is codenamed Darwin and returns:

'darwin-14.3.0-x86_64-i386-64bit'

for platform.platform().lower(). See https://github.com/ropensci/ecoretriever/issues/50.

We need a more precise platform check to avoid thinking that OS X 10.10 is Windows.

A big thanks for @davharris for running into this and helping me track it down.

ethanwhite commented 9 years ago

Looks like switching to `platform.system().lower() == 'windows' should work.

ethanwhite commented 9 years ago

We currently check the platform in a few places

ethan@simon:~/RetrieverCode (fix-windows-check)$ grep -r 'platform.platform' *
engines/msaccess.py:        p = platform.platform().lower()
__init__.py:current_platform = platform.platform().lower()
__main__.py:        check_for_updates(graphical=False if 'darwin' in platform.platform().lower() else True)
setup.py:p = platform.platform().lower()