#!/usr/bin/env python3

import sys
import os.path

# get base path of example module
MBASE = ''
try:
  # if we are installed
  import asap.examples
  import inspect
  MBASE = os.path.join(os.path.dirname(inspect.getfile(asap.examples)), '..')
except ImportError:
  # if we are in repo
  MBASE = os.path.join(os.path.dirname(os.path.abspath(sys.argv[0])), '..', 'asap')
MBASE = os.path.abspath(MBASE)
# print(MBASE)

# get path of binary
BBASE = os.path.dirname(os.path.abspath(sys.argv[0]))

import subprocess
ARG="--debug --verbose"
ARG=""

subprocess.call("cat {}/examples/minimal-onoffswitch.asap |{}/asap --plugins=asap.plugins.tkinter {}".format(MBASE, BBASE, ARG), shell=True)

