#!/usr/bin/env python

# add borg package(s) to the Python search path
import sys
import os.path
import plac

module_paths = [
    "borg/build/lib",
    "cargo/build/lib",
    ]
here = os.path.abspath(os.path.dirname(__file__))

for path in module_paths:
    sys.path.insert(0, os.path.join(here, path))

# configure paths to resources
import borg

borg.defaults.solvers_root = os.path.join(here, "solvers")

with open(os.path.join(here, "etc/model_speed")) as model_file:
    with open(os.path.join(here, "etc/local_speed")) as local_file:
        model_speed = float(model_file.read())
        local_speed = float(local_file.read())

        borg.defaults.machine_speed = local_speed / model_speed

# launch the solver
if __name__ == "__main__":
    from borg.tools.solve import main

    plac.call(main)

