#!/usr/bin/python

# @ Martin Kellogg ; May 2015

# This script takes a genprog configuration file for an existing benchmark program and converts it into a form usable by the proactive diversity scripts

# this particular version is meant for php instrumentation, July 1 2015

import sys

config_file = sys.argv[1]

mpOverwrite = {"--pos-tests" : "0", "--popsize" : "0" , "--search" : "pd-explore", "--sanity" : "yes", "--no-test-cache" : "", "--no-rep-cache": ""}

for ln in open(config_file):
    ln = ln.strip()
    if ln is "":
        continue
    if ln.startswith("#"):
        continue
    option = ln.split()[0]
    if option in mpOverwrite:
        print option + " " + mpOverwrite[option]
        del mpOverwrite[option]
    else:
        print ln

for option in mpOverwrite.keys():
    print option + " " + mpOverwrite[option]
