#!/usr/bin/env python3

#import copy
import os
#import os.path
import subprocess
#import sys

# Wrapper for Bandage June 16, 2021

if 'BIRCH' in os.environ:
    BIRCH = os.environ.get('BIRCH')
    print('BIRCH=' + BIRCH)
else :
    print('bandage.py: BIRCH environment variable not set')
    exit(1)

if 'BIRCH_PLATFORM' in os.environ:
    BIRCH_PLATFORM = os.environ.get('BIRCH_PLATFORM')
    print('BIRCH_PLATFORM=' + BIRCH_PLATFORM)


if BIRCH_PLATFORM == 'osx-x86_64':
    subprocess.call(['open', os.path.join(BIRCH, 'lib-osx-x86_64', 'Bandage', 'Bandage.app')])
elif BIRCH_PLATFORM == 'macos-arm64':
    subprocess.call(['open', os.path.join(BIRCH, 'lib-macos-arm64', 'Bandage', 'Bandage.app')])
else:
    subprocess.call([os.path.join(BIRCH, 'bin-'+BIRCH_PLATFORM, 'Bandage')])

