#!/usr/bin/env python
import sys
import os


args = ""
for i in range(1,len(sys.argv)):
    args += " " + sys.argv[i]

command = "pip show ravegen-dev > .tempPythonFile"
os.system(command)
tempFile = open(".tempPythonFile", 'r')
pythonPath = None
for line in tempFile:
    tokens = line.split(" ")
    tokens[-1] = tokens[-1].rstrip('\n')
    if(tokens[0] == "Location:"):
        pythonPath = tokens[1]
tempFile.close()
command = "rm -f .tempPythonFile"
os.system(command)

if pythonPath == None:
    print("Something is wrong with installation")
    sys.exit()

command = "python " + pythonPath + "/ravegen/main.py " + args

os.system(command)
