import sys

resolver = None

if sys.platform == "linux2":
    from . import linux
    resolver = linux.Resolver
elif sys.platform == "darwin":
    from . import osx
    resolver = osx.Resolver
elif sys.platform.startswith("freebsd"):
    from . import osx
    resolver = osx.Resolver
elif sys.platform == "win32":
    from . import windows
    resolver = windows.Resolver

import sys
import re

resolver = None

if re.match(r"linux(?:2)?", sys.platform):
    from . import linux
    resolver = linux.Resolver
elif sys.platform == "darwin":
    from . import osx
    resolver = osx.Resolver
elif sys.platform.startswith("freebsd"):
    from . import osx
    resolver = osx.Resolver
elif sys.platform == "win32":
    from . import windows
    resolver = windows.Resolver

Fix platform import on Linux using python3
Fix platform import on Linux using python3

Using python3, sys.platform returns "linux" instead of "linux2" using
python2. This patch accepts "linux" as well as "linux2".

  import sys
+ import re
  
  resolver = None
  
- if sys.platform == "linux2":
+ if re.match(r"linux(?:2)?", sys.platform):
      from . import linux
      resolver = linux.Resolver
  elif sys.platform == "darwin":
      from . import osx
      resolver = osx.Resolver
  elif sys.platform.startswith("freebsd"):
      from . import osx
      resolver = osx.Resolver
  elif sys.platform == "win32":
      from . import windows
      resolver = windows.Resolver
  
Fix platform import on Linux using python3
## Code Before:
import sys

resolver = None

if sys.platform == "linux2":
    from . import linux
    resolver = linux.Resolver
elif sys.platform == "darwin":
    from . import osx
    resolver = osx.Resolver
elif sys.platform.startswith("freebsd"):
    from . import osx
    resolver = osx.Resolver
elif sys.platform == "win32":
    from . import windows
    resolver = windows.Resolver

## Instruction:
Fix platform import on Linux using python3
## Code After:
import sys
import re

resolver = None

if re.match(r"linux(?:2)?", sys.platform):
    from . import linux
    resolver = linux.Resolver
elif sys.platform == "darwin":
    from . import osx
    resolver = osx.Resolver
elif sys.platform.startswith("freebsd"):
    from . import osx
    resolver = osx.Resolver
elif sys.platform == "win32":
    from . import windows
    resolver = windows.Resolver
