#!/usr/bin/env bats load test_helper export PYTHON_BUILD_CACHE_PATH="$TMP/cache" export MAKE=make export MAKE_OPTS="-j 2" export CC=cc export -n PYTHON_CONFIGURE_OPTS setup() { mkdir -p "$INSTALL_ROOT" stub md5 false stub aria2c false } executable() { local file="$1" mkdir -p "${file%/*}" cat > "$file" chmod +x "$file" } cached_tarball() { mkdir -p "$PYTHON_BUILD_CACHE_PATH" pushd "$PYTHON_BUILD_CACHE_PATH" >/dev/null tarball "$@" popd >/dev/null } tarball() { local name="$1" local path="$PWD/$name" local configure="$path/configure" shift 1 executable "$configure" <> build.log echo "$name: \$@" \${PYTHONOPT:+PYTHONOPT=\$PYTHONOPT} >> build.log OUT for file; do mkdir -p "$(dirname "${path}/${file}")" touch "${path}/${file}" done tar czf "${path}.tar.gz" -C "${path%/*}" "$name" } stub_make_install() { stub "$MAKE" \ " : echo \"$MAKE \$@\" >> build.log" \ "install : echo \"$MAKE \$@\" >> build.log && cat build.log >> '$INSTALL_ROOT/build.log'" } assert_build_log() { run cat "$INSTALL_ROOT/build.log" assert_output } @test "yaml is installed for python" { cached_tarball "yaml-0.1.6" cached_tarball "Python-3.2.1" stub brew false stub_make_install stub_make_install install_fixture definitions/needs-yaml assert_success unstub make assert_build_log <> build.log' TMPDIR="$TMP" install_fixture --patch definitions/needs-yaml <<<"" assert_success unstub make unstub patch assert_build_log <> build.log' TMPDIR="$TMP" install_fixture --patch definitions/needs-yaml <<<"diff --git a/script.py" assert_success unstub make unstub patch assert_build_log <> build.log' stub_make_install export PYTHON_CONFIGURE="${TMP}/custom-configure" run_inline_definition <