#!/usr/bin/env python

import sys
import os
import argparse

READIES_PATH = os.path.realpath(os.path.join(os.path.dirname(__file__), ".."))
sys.path.insert(0, READIES_PATH)
import paella

parser = argparse.ArgumentParser(description='Report platform characteristics.')
parser.add_argument('--os', action="store_true", help='Operating system')
parser.add_argument('--version', action="store_true", help='OS/Distribution version')
parser.add_argument('--dist', action="store_true", help='Linux distribution (if applicable)')
parser.add_argument('--arch', action="store_true", help='CPU Architecture')
parser.add_argument('--kernel', action="store_true", help='Kernel version (if applicable)')
parser.add_argument('--glibc', action="store_true", help='GLIBC version (if applicable)')
parser.add_argument('--strict', action="store_true", help='Fail if cannot identify platform')
args = parser.parse_args()

try:
    platform = paella.Platform(strict=args.strict)
except:
    eprint("platform: cannot identify")
    exit(1)
ret = ""
if args.os:
	ret += " " + platform.os
if args.dist:
	ret += " " + platform.dist
if args.version:
	ret += " " + platform.os_ver
if args.arch:
	ret += " " + platform.arch
if args.kernel:
	pass
if args.glibc:
	pass
if ret == "":
    os = platform.os
    dist = platform.dist
    if dist != "":
        os = dist + " " + os
    ret = os + " " + platform.os_ver + " " + platform.arch
print(ret.strip())
