def ensure_utool(CODE_DIR, pythoncmd):
    WIN32 = sys.platform.startswith('win32')
    UTOOL_BRANCH = 'next'
    UTOOL_REPO = 'https://github.com/WildbookOrg/utool.git'
    print('WARNING: utool is not found')
    print('Attempting to get utool. Enter (y) to continue')
    if ('-y' in sys.argv):
        ans = 'y'
    else:
        try:
            ans = input('Enter y to continue. Anything else to exit...\n')
        except:
            ans = raw_input('Enter y to continue. Anything else to exit...\n')
    if (ans != 'y'):
        print('Please install utool to continue')
        sys.exit(0)
    cwdpath = os.path.realpath(os.getcwd())
    usr_code_dir = os.path.expanduser(CODE_DIR)
    os.chdir(usr_code_dir)
    print(('user code dir = %r' % usr_code_dir))
    print('cloning utool')
    if (not os.path.exists('utool')):
        syscmd(((('git clone ' + UTOOL_REPO) + ' -b ') + UTOOL_BRANCH))
    os.chdir('utool')
    print('pulling utool')
    syscmd('git pull')
    print('installing utool for development')
    cmdstr = '{pythoncmd} -m pip install -e .'.format(pythoncmd=pythoncmd)
    if ((not WIN32) and (not in_virtual_env())):
        cmdstr = ('sudo ' + cmdstr)
    syscmd(cmdstr)
    os.chdir(cwdpath)
    print('Please rerun super_setup.py')
    print(' '.join(sys.argv))
    sys.exit(1)
def ensure_utool(CODE_DIR, pythoncmd):
    WIN32 = sys.platform.startswith('win32')
    UTOOL_BRANCH = 'next'
    UTOOL_REPO = 'https://github.com/WildbookOrg/utool.git'
    print('WARNING: utool is not found')
    print('Attempting to get utool. Enter (y) to continue')
    if ('-y' in sys.argv):
        ans = 'y'
    else:
        try:
            ans = input('Enter y to continue. Anything else to exit...\n')
        except:
            ans = raw_input('Enter y to continue. Anything else to exit...\n')
    if (ans != 'y'):
        print('Please install utool to continue')
        sys.exit(0)
    cwdpath = os.path.realpath(os.getcwd())
    usr_code_dir = os.path.expanduser(CODE_DIR)
    os.chdir(usr_code_dir)
    print(('user code dir = %r' % usr_code_dir))
    print('cloning utool')
    if (not os.path.exists('utool')):
        syscmd(((('git clone ' + UTOOL_REPO) + ' -b ') + UTOOL_BRANCH))
    os.chdir('utool')
    print('pulling utool')
    syscmd('git pull')
    print('installing utool for development')
    cmdstr = '{pythoncmd} -m pip install -e .'.format(pythoncmd=pythoncmd)
    if ((not WIN32) and (not in_virtual_env())):
        cmdstr = ('sudo ' + cmdstr)
    syscmd(cmdstr)
    os.chdir(cwdpath)
    print('Please rerun super_setup.py')
    print(' '.join(sys.argv))
    sys.exit(1)