#!/usr/bin/env python
# coding: utf-8

import os
import subprocess

static_index_path = os.path.join(os.environ['PWD'], 'static_index_resource')

if os.path.isdir(static_index_path):
    # if directory with static index resource exists use it as index dir
    print(static_index_path)
    exit()
else:
    #  No static index resource
    if os.getenv('DEPLOY_ENGINE', 'GENERIC') == 'YP_LITE':
        print('/data/index/project')
        exit()
    else:
        select_drive = subprocess.check_output(['./loop_data/loop_data/select_drive.sh']).strip()
        print('{}/webcache/{}/index/project'.format(select_drive, os.environ['BSCONFIG_INAME']))
