import os
import shutil

SOURCE_DIR = '../deploy/runtime'
TARGET_DIR = 'SAM.app/Contents/runtime'

if os.path.exists(TARGET_DIR):
    shutil.rmtree(TARGET_DIR)

shutil.copytree(SOURCE_DIR, TARGET_DIR, ignore=shutil.ignore_patterns('.git'))

SOURCE_DIR = '../deploy/solar_resource'
TARGET_DIR = 'SAM.app/Contents/solar_resource'

if os.path.exists(TARGET_DIR):
    shutil.rmtree(TARGET_DIR)

shutil.copytree(SOURCE_DIR, TARGET_DIR, ignore=shutil.ignore_patterns('.git'))

SOURCE_DIR = '../deploy/wind_resource'
TARGET_DIR = 'SAM.app/Contents/wind_resource'

if os.path.exists(TARGET_DIR):
    shutil.rmtree(TARGET_DIR)

shutil.copytree(SOURCE_DIR, TARGET_DIR, ignore=shutil.ignore_patterns('.git'))

SOURCE_DIR = '../deploy/libraries'
TARGET_DIR = 'SAM.app/Contents/libraries'

if os.path.exists(TARGET_DIR):
    shutil.rmtree(TARGET_DIR)

shutil.copytree(SOURCE_DIR, TARGET_DIR, ignore=shutil.ignore_patterns('.git'))

[(7, 'os.path.exists', 'os.path.exists', (['TARGET_DIR'], {}), False, 'import os\n'), (15, 'os.path.exists', 'os.path.exists', (['TARGET_DIR'], {}), False, 'import os\n'), (23, 'os.path.exists', 'os.path.exists', (['TARGET_DIR'], {}), False, 'import os\n'), (31, 'os.path.exists', 'os.path.exists', (['TARGET_DIR'], {}), False, 'import os\n'), (8, 'shutil.rmtree', 'shutil.rmtree', (['TARGET_DIR'], {}), False, 'import shutil\n'), (16, 'shutil.rmtree', 'shutil.rmtree', (['TARGET_DIR'], {}), False, 'import shutil\n'), (24, 'shutil.rmtree', 'shutil.rmtree', (['TARGET_DIR'], {}), False, 'import shutil\n'), (32, 'shutil.rmtree', 'shutil.rmtree', (['TARGET_DIR'], {}), False, 'import shutil\n'), (10, 'shutil.ignore_patterns', 'shutil.ignore_patterns', (['""".git"""'], {}), False, 'import shutil\n'), (18, 'shutil.ignore_patterns', 'shutil.ignore_patterns', (['""".git"""'], {}), False, 'import shutil\n'), (26, 'shutil.ignore_patterns', 'shutil.ignore_patterns', (['""".git"""'], {}), False, 'import shutil\n'), (34, 'shutil.ignore_patterns', 'shutil.ignore_patterns', (['""".git"""'], {}), False, 'import shutil\n')]