#!/bin/bash python_sane_check() { Quiet python -V || wrap_fail "This is a python type recipe and you don't seem to have python installed." } # Can be overridden by the recipe python_major= python=python${python_major} pythonversion=$($python -V 2>&1 | sed 's,Python \([0-9]*\.[0-9]*\).*,\1,') sitepackages="${target}/lib/python${pythonversion}/site-packages" python_init() { create_dirs_first="yes" build_target="build" } build_python_options() { # should exist in other modes too (eg, configure) if [ "$override_default_options" = "yes" ] then default_python_options=() else case "$1" in build) default_python_options=() ;; build_ext) default_python_options=( "--build-lib $sitepackages" ) ;; install) default_python_options=( "--prefix $target" ) ;; esac fi eval $(Combine_Arrays opts python_options default_python_options) Add_Use_Flags_Options_To_Array opts if [ ! -z "$goboIndex" ] then opts=(`echo ${opts[@]} | sed "s,$target,$goboIndex,g"`) fi # This must occur after the source is unpacked, so it can't go in _init. # We have to guard against build_script being set from the recipe, or # earlier in the compile process. if ! [ "${build_script}" ] then for i in setup.py configure.py build.py do [ -e "${sourcedir}/${i}" ] && build_script="$i" done fi } python_do_build() { $sudo_exec mkdir -p "$sitepackages" build_python_options $build_target $python $build_script $build_target ${opts[*]} || wrap_fail "Build failed." } python_do_install() { build_python_options $install_target SandboxInstall $verbose ${unmanagedlist:+--unmanaged-files "${unmanagedlist}"} ${sandboxopts:+"${sandboxopts[@]}"} -c $python "$appname" "$versionnumber" -- $build_script $install_target --root / ${opts[*]} || wrap_fail "Installation failed" }