# Path: install_scripts/common.py
# ICM_AGENT_ROOT = ''
# BIN_DIRNAME = os.path.join(ICM_AGENT_ROOT,'bin')
# ICM_AGENT_MAIN = os.path.join(BIN_DIRNAME, 'icm-agent')
# CONFIG_DIR = os.path.join(ICM_AGENT_ROOT,'conf')
# DOCS_DIR = os.path.join(ICM_AGENT_ROOT,'docs')
# LOG_DIR = os.path.join(ICM_AGENT_ROOT,'log')
# LOCALES_DIR = os.path.join(ICM_AGENT_ROOT,'share', 'locales')
# IMAGES_DIR = os.path.join(ICM_AGENT_ROOT,'share', 'images')
# ICONS_DIR = os.path.join(ICM_AGENT_ROOT,'share', 'icons')
# DB_DIR = os.path.join(ICM_AGENT_ROOT,'share', 'db')
# TMP_DIR = os.path.join(ICM_AGENT_ROOT,'tmp')
# TOOLS_DIR = os.path.join(ICM_AGENT_ROOT,'tools')
# UMITLIB_DIR = os.path.join(ICM_AGENT_ROOT,'umit')


import os
import shutil
from setuptools import setup
from install_scripts import common

    ROOT_DIR = os.path.abspath(
                    os.path.join(os.path.dirname(unicode(__file__,encoding)),os.path.pardir))
        
if os.path.exists(os.path.join(ROOT_DIR,'umit')):
     sys.path.insert(0, ROOT_DIR)
     execfile(os.path.join(ROOT_DIR, 'deps', 'umit-common', 'utils', 'importer.py'))
     sys.path.insert(0, os.path.join(ROOT_DIR, 'deps'))
     sys.path.insert(0, os.path.join(ROOT_DIR, 'deps', 'icm-common'))
     sys.path.insert(0, os.path.join(ROOT_DIR, 'deps', 'umit-common'))
     sys.path.insert(0, os.path.join(ROOT_DIR, 'deps', 'higwidgets'))
else:
     raise Exception("Can't find root dir.")




# py2app requires the values in the app's list to have known extensions, but
# bin/umit doesn't. Here bin/umit is renamed to bin/umit_main.py and the old
# name is stored in common.OLD_UMIT_MAIN so it can be renamed again later.
shutil.move(common.UMIT_MAIN, common.UMIT_MAIN + '_main.py')
common.OLD_UMIT_MAIN = common.UMIT_MAIN
common.UMIT_MAIN = os.path.join(common.BIN_DIRNAME, 'umit_main.py')

def revert_rename():
    if not hasattr(common, 'OLD_UMIT_MAIN'):
        # The rename hasn't happened.
        return
    shutil.move(common.UMIT_MAIN, common.OLD_UMIT_MAIN)

py2app_options = dict(

# Path: install_scripts/common.py
# ICM_AGENT_ROOT = ''
# BIN_DIRNAME = os.path.join(ICM_AGENT_ROOT,'bin')
# ICM_AGENT_MAIN = os.path.join(BIN_DIRNAME, 'icm-agent')
# CONFIG_DIR = os.path.join(ICM_AGENT_ROOT,'conf')
# DOCS_DIR = os.path.join(ICM_AGENT_ROOT,'docs')
# LOG_DIR = os.path.join(ICM_AGENT_ROOT,'log')
# LOCALES_DIR = os.path.join(ICM_AGENT_ROOT,'share', 'locales')
# IMAGES_DIR = os.path.join(ICM_AGENT_ROOT,'share', 'images')
# ICONS_DIR = os.path.join(ICM_AGENT_ROOT,'share', 'icons')
# DB_DIR = os.path.join(ICM_AGENT_ROOT,'share', 'db')
# TMP_DIR = os.path.join(ICM_AGENT_ROOT,'tmp')
# TOOLS_DIR = os.path.join(ICM_AGENT_ROOT,'tools')
# UMITLIB_DIR = os.path.join(ICM_AGENT_ROOT,'umit')


# Path: install_scripts/macosx/py2app_setup.py
import os
import shutil
from setuptools import setup
from install_scripts import common

    ROOT_DIR = os.path.abspath(
                    os.path.join(os.path.dirname(unicode(__file__,encoding)),os.path.pardir))
        
if os.path.exists(os.path.join(ROOT_DIR,'umit')):
     sys.path.insert(0, ROOT_DIR)
     execfile(os.path.join(ROOT_DIR, 'deps', 'umit-common', 'utils', 'importer.py'))
     sys.path.insert(0, os.path.join(ROOT_DIR, 'deps'))
     sys.path.insert(0, os.path.join(ROOT_DIR, 'deps', 'icm-common'))
     sys.path.insert(0, os.path.join(ROOT_DIR, 'deps', 'umit-common'))
     sys.path.insert(0, os.path.join(ROOT_DIR, 'deps', 'higwidgets'))
else:
     raise Exception("Can't find root dir.")




# py2app requires the values in the app's list to have known extensions, but
# bin/umit doesn't. Here bin/umit is renamed to bin/umit_main.py and the old
# name is stored in common.OLD_UMIT_MAIN so it can be renamed again later.
shutil.move(common.UMIT_MAIN, common.UMIT_MAIN + '_main.py')
common.OLD_UMIT_MAIN = common.UMIT_MAIN
common.UMIT_MAIN = os.path.join(common.BIN_DIRNAME, 'umit_main.py')

def revert_rename():
    if not hasattr(common, 'OLD_UMIT_MAIN'):
        # The rename hasn't happened.
        return
    shutil.move(common.UMIT_MAIN, common.OLD_UMIT_MAIN)

py2app_options = dict(

        app = [common.UMIT_MAIN],
