def _install_hook():
    # install script ensures that oppia is root
    oppia_dir = os.getcwd()
    hooks_dir = os.path.join(oppia_dir, '.git', 'hooks')
    pre_push_file = os.path.join(hooks_dir, 'pre-push')
    if os.path.islink(pre_push_file):
        print 'Symlink already exists'
        return
    try:
        os.symlink(os.path.abspath(__file__), pre_push_file)
        print 'Created symlink in .git/hooks directory'
    # raises AttributeError on windows, OSError added as failsafe
    except (OSError, __HOLE__):
        shutil.copy(__file__, pre_push_file)
        print 'Copied file to .git/hooks directory'
dataset/ETHPy150Open oppia/oppia/scripts/pre_push_hook.py/_install_hook