#! /bin/env python

# For playing around with HostMatcher functionality


AVAILABLE = [
  {"OS" : "Linux",   "ISA" : "i386" },
  {"OS" : "Linux",   "ISA" : "i586" },
  {"OS" : "FreeBSD", "ISA" : "i686" },
  {"OS" : "Windows", "ISA" : "i586" },
  ]


# Try the given platform ID and see which AVAILABLE platform ID
# matches.
def test(request):
  import HostMatcher
  print "Request:", repr(request)
  result = HostMatcher.match(request, AVAILABLE);
  if result is None:
    print "  [no match]"
  else:
    print "  Match:", repr(result)


def main(args):
  test({"OS" : "Cygwin",  "ISA" : "amd64"});
  test({"OS" : "FreeBSD", "ISA" : "i486"});
  test({"OS" : "Linux",   "ISA" : "amd64"});
  test({"OS" : "Linux",   "ISA" : "i486"});
  test({"OS" : "Windows", "ISA" : "i486"});

if __name__ == "__main__":
  import sys
  main(sys.argv[1:])

