def _execute_deployment():
    # Check that the current directory is correct.
    common.require_cwd_to_be_oppia()

    current_git_revision = subprocess.check_output(
        ['git', 'rev-parse', 'HEAD']).strip()

    print ''
    print 'Starting deployment process.'

    if not os.path.exists(THIRD_PARTY_DIR):
        raise Exception(
            'Could not find third_party directory at %s. Please run start.sh '
            'prior to running this script.' % THIRD_PARTY_DIR)

    # Create a folder in which to save the release candidate.
    print 'Ensuring that the release directory parent exists'
    common.ensure_directory_exists(os.path.dirname(RELEASE_DIR_PATH))

    # Copy files to the release directory. Omits the .git subfolder.
    print 'Copying files to the release directory'
    shutil.copytree(
        os.getcwd(), RELEASE_DIR_PATH, ignore=shutil.ignore_patterns('.git'))

    # Change the current directory to the release candidate folder.
    with common.CD(RELEASE_DIR_PATH):
        if not os.getcwd().endswith(RELEASE_DIR_NAME):
            raise Exception(
                'Invalid directory accessed during deployment: %s'
                % os.getcwd())

        print os.getcwd() % 'Changing directory to %s'

        print 'Preprocessing release...'
        preprocess_release()

        # Do a build; ensure there are no errors.
        print 'Building and minifying scripts...'
        subprocess.check_output(['python', 'scripts/build.py'])

        # Run the tests; ensure there are no errors.
        print 'Running tests...'
        tests_proc = subprocess.Popen([
            'bash', os.path.join('scripts', 'run_tests.sh')
        ], stdout=subprocess.PIPE)
        tests_stdout, tests_stderr = tests_proc.communicate()
        print tests_stdout
        print tests_stderr

        if tests_proc.returncode != 0:
            raise Exception('Tests failed. Halting deployment.')

        # Deploy to GAE.
        subprocess.check_output([APPCFG_PATH, 'update', '.', '--oauth2'])

        # Writing log entry.
        common.ensure_directory_exists(os.path.dirname(LOG_FILE_PATH))
        with open(LOG_FILE_PATH, 'a') as log_file:
            log_file.write(
                'Successfully deployed to %s at %s (version %s)\n' % (
                    APP_NAME, CURRENT_DATETIME.strftime('%Y-%m-%d %H:%M:%S'),
                    current_git_revision))

        print 'Returning to oppia/ root directory.'

    print 'Done!'
dataset/ETHPy150Open oppia/oppia/scripts/deploy.py/_execute_deployment/swapped operands of `%`