benchmarks /

Full commit
#! /usr/bin/env bash
# NOTE: most benchmarks are natively Python 3-compatible and don't need
# to be translated.  Simply run with `-b 2n3` to run them.
# Usage:
#   hg clone py2benchmarks
#   mkdir py3benchmarks;
#   cd py3benchmarks
#   ../py2benchmarks/ ../py2benchmarks
#   python3.1 -b py3k old_py3k new_py3k

set -e

srcdir=$(cd "$1" && pwd -P)

if [ "x$srcdir" = x ]; then
    echo "Specify the source directory as the first argument."
    exit 1
if [ "$srcdir" = $(pwd -P) ]; then
    echo "Can't generate python 3 into the same directory as python 2 version."
    exit 1


# Update the files in place.
CONVERT="${py2_6} ${srcdir}/lib/2to3/2to3 --write --nobackups --no-diffs"

rm -rf* lib performance

cp "${srcdir}/"

# Libraries that are Python 3 compatible as-is.
SAFE_LIBS_AS_IS="Chameleon-2.9.2 pathlib"
# Libraries that work with Python 3 after passing through 2to3.
SAFE_LIBS_TO_TRANSLATE="2to3 mako-0.3.6 Mako-0.7.3"
# Libraries whose source is Python 3 only.

mkdir lib
for safe_lib in ${SAFE_LIBS_AS_IS}; do
  cp -a "${srcdir}/lib/${safe_lib}" lib/${safe_lib}

for safe_lib in ${SAFE_LIBS_TO_TRANSLATE}; do
  cp -a "${srcdir}/lib/${safe_lib}" lib/${safe_lib}
  ${CONVERT} lib/${safe_lib}

for safe_lib in ${SAFE_LIBS_PORTED}; do
  cp -a "${srcdir}/lib3/${safe_lib}" lib/${safe_lib}

# Touch-ups
cp ${srcdir}/lib3/ lib/Chameleon-2.9.2/src

cp -a "${srcdir}/performance" performance

# The 2to3 benchmark looks for sample data to run over behind the
# 2to3_data symlink.  That needs to point to python-2 source, even
# though we're running 2to3 inside python-3.
( cd lib; ln -sf "${srcdir}/lib/2to3" 2to3_data )