Cache uname and sw_vers output (#3244)

Mainly for tests, to avoid having to adjust call counts for stubs when the logic changes
This commit is contained in:
native-api 2025-05-06 19:17:36 +03:00 committed by GitHub
parent ee40ad2253
commit bc7b6cb6b5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 76 additions and 79 deletions

View File

@ -106,7 +106,7 @@ os_information() {
if type -p lsb_release >/dev/null; then if type -p lsb_release >/dev/null; then
lsb_release -sir | xargs echo lsb_release -sir | xargs echo
elif type -p sw_vers >/dev/null; then elif type -p sw_vers >/dev/null; then
echo "OS X $(sw_vers -productVersion)" echo "OS X ${_PYTHON_BUILD_CACHE_SW_VERS:=$(sw_vers -productVersion)}"
elif [ -r /etc/os-release ]; then elif [ -r /etc/os-release ]; then
source /etc/os-release source /etc/os-release
echo "$NAME" $VERSION_ID echo "$NAME" $VERSION_ID
@ -117,7 +117,7 @@ os_information() {
} }
is_mac() { is_mac() {
[ "$(uname -s)" = "Darwin" ] || return 1 [ "${_PYTHON_BUILD_CACHE_UNAME_S:=$(uname -s)}" = "Darwin" ] || return 1
[ $# -eq 0 ] || [ "$(osx_version)" "$@" ] [ $# -eq 0 ] || [ "$(osx_version)" "$@" ]
} }
@ -140,7 +140,7 @@ can_use_homebrew() {
# 10.10 -> 1010 # 10.10 -> 1010
osx_version() { osx_version() {
local -a ver local -a ver
IFS=. ver=( `sw_vers -productVersion` ) IFS=. ver=( ${_PYTHON_BUILD_CACHE_SW_VERS:=$(sw_vers -productVersion)} )
IFS="$OLDIFS" IFS="$OLDIFS"
echo $(( ${ver[0]}*100 + ${ver[1]} )) echo $(( ${ver[0]}*100 + ${ver[1]} ))
} }
@ -179,7 +179,7 @@ file_is_not_empty() {
num_cpu_cores() { num_cpu_cores() {
local num local num
case "$(uname -s)" in case "${_PYTHON_BUILD_CACHE_UNAME_S:=$(uname -s)}" in
Darwin | *BSD ) Darwin | *BSD )
num="$(sysctl -n hw.ncpu 2>/dev/null || true)" num="$(sysctl -n hw.ncpu 2>/dev/null || true)"
;; ;;
@ -971,7 +971,7 @@ build_package_micropython() {
} }
pypy_architecture() { pypy_architecture() {
case "$(uname -s)" in case "${_PYTHON_BUILD_CACHE_UNAME_S:=$(uname -s)}" in
"Darwin" ) "Darwin" )
case "$(uname -m)" in case "$(uname -m)" in
"arm64" ) echo "osarm64" ;; "arm64" ) echo "osarm64" ;;
@ -1003,7 +1003,7 @@ pypy_architecture() {
} }
graalpy_architecture() { graalpy_architecture() {
case "$(uname -s)" in case "${_PYTHON_BUILD_CACHE_UNAME_S:=$(uname -s)}" in
"Darwin" ) "Darwin" )
case "$(uname -m)" in case "$(uname -m)" in
"x86_64" ) echo "macos-amd64" ;; "x86_64" ) echo "macos-amd64" ;;
@ -1084,7 +1084,7 @@ build_package_pypy_builder() {
} }
activepython_architecture() { activepython_architecture() {
case "$(uname -s)" in case "${_PYTHON_BUILD_CACHE_UNAME_S:=$(uname -s)}" in
"Darwin" ) echo "macosx10.9-i386-x86_64" ;; "Darwin" ) echo "macosx10.9-i386-x86_64" ;;
"Linux" ) "Linux" )
case "$(uname -m)" in case "$(uname -m)" in
@ -1104,7 +1104,7 @@ build_package_activepython() {
} }
anaconda_architecture() { anaconda_architecture() {
case "$(uname -s)" in case "${_PYTHON_BUILD_CACHE_UNAME_S:=$(uname -s)}" in
"Darwin" ) "Darwin" )
case "$(uname -m)" in case "$(uname -m)" in
"arm64" ) echo "MacOSX-arm64" ;; "arm64" ) echo "MacOSX-arm64" ;;
@ -1381,7 +1381,7 @@ require_osx_version() {
function version { echo "$@" | awk -F. '{ printf("%d%03d%03d%03d\n", $1,$2,$3,$4); }'; } function version { echo "$@" | awk -F. '{ printf("%d%03d%03d%03d\n", $1,$2,$3,$4); }'; }
local required_version="$@" local required_version="$@"
local osx_version="$(sw_vers -productVersion)" local osx_version="${_PYTHON_BUILD_CACHE_SW_VERS:=$(sw_vers -productVersion)}"
if [[ $(version $osx_version) -ge $(version $required_version) ]]; then if [[ $(version $osx_version) -ge $(version $required_version) ]]; then
return 0 return 0
fi fi
@ -1457,14 +1457,14 @@ use_homebrew_yaml() {
use_freebsd_pkg() { use_freebsd_pkg() {
# check if FreeBSD # check if FreeBSD
if [ "FreeBSD" = "$(uname -s)" ]; then if [ "FreeBSD" = "${_PYTHON_BUILD_CACHE_UNAME_S:=$(uname -s)}" ]; then
# use openssl if installed from Ports Collection # use openssl if installed from Ports Collection
if pkg info -e openssl; then if pkg info -e openssl; then
package_option python configure --with-openssl="/usr/local" package_option python configure --with-openssl="/usr/local"
fi fi
# check if 11-R or later # check if 11-R or later
release="$(uname -r)" release="${_PYTHON_BUILD_CACHE_UNAME_R:=$(uname -r)}"
if [ "${release%%.*}" -ge 11 ]; then if [ "${release%%.*}" -ge 11 ]; then
# Use packages from Ports Collection. # Use packages from Ports Collection.
# #
@ -2251,11 +2251,13 @@ if [ -n "$noexec" ]; then
fi fi
if [ -z "$MAKE" ]; then if [ -z "$MAKE" ]; then
if [ "FreeBSD" = "$(uname -s)" ]; then if [ "FreeBSD" = "${_PYTHON_BUILD_CACHE_UNAME_S:=$(uname -s)}" ]; then
if [ "$(echo $1 | sed 's/-.*$//')" = "jruby" ]; then if [ "$(echo $1 | sed 's/-.*$//')" = "jruby" ]; then
export MAKE="gmake" export MAKE="gmake"
else else
if [ "$(uname -r | sed 's/[^[:digit:]].*//')" -lt 10 ]; then # var assignment inside $() does not propagate due to being in subshell
: "${_PYTHON_BUILD_CACHE_UNAME_R:=$(uname -r)}"
if [ "$(echo "$_PYTHON_BUILD_CACHE_UNAME_R" | sed 's/[^[:digit:]].*//')" -lt 10 ]; then
export MAKE="gmake" export MAKE="gmake"
else else
export MAKE="make" export MAKE="make"
@ -2450,7 +2452,7 @@ fi
# Set MACOSX_DEPLOYMENT_TARGET from the product version of OS X (#219, #220) # Set MACOSX_DEPLOYMENT_TARGET from the product version of OS X (#219, #220)
if is_mac; then if is_mac; then
if [ -z "${MACOSX_DEPLOYMENT_TARGET}" ]; then if [ -z "${MACOSX_DEPLOYMENT_TARGET}" ]; then
MACOS_VERSION="$(sw_vers -productVersion 2>/dev/null || true)" MACOS_VERSION="${_PYTHON_BUILD_CACHE_SW_VERS:=$(sw_vers -productVersion)}"
MACOS_VERSION_ARRAY=(${MACOS_VERSION//\./ }) MACOS_VERSION_ARRAY=(${MACOS_VERSION//\./ })
if [ "${#MACOS_VERSION_ARRAY[@]}" -ge 2 ]; then if [ "${#MACOS_VERSION_ARRAY[@]}" -ge 2 ]; then
export MACOSX_DEPLOYMENT_TARGET="${MACOS_VERSION_ARRAY[0]}.${MACOS_VERSION_ARRAY[1]}" export MACOSX_DEPLOYMENT_TARGET="${MACOS_VERSION_ARRAY[0]}.${MACOS_VERSION_ARRAY[1]}"

View File

@ -62,7 +62,7 @@ assert_build_log() {
cached_tarball "yaml-0.1.6" cached_tarball "yaml-0.1.6"
cached_tarball "Python-3.6.2" cached_tarball "Python-3.6.2"
for i in {1..10}; do stub uname '-s : echo Linux'; done stub uname '-s : echo Linux'
stub brew false stub brew false
stub_make_install stub_make_install
stub_make_install stub_make_install
@ -104,7 +104,7 @@ OUT
cached_tarball "yaml-0.1.6" "$yaml_configure" cached_tarball "yaml-0.1.6" "$yaml_configure"
cached_tarball "Python-3.6.2" cached_tarball "Python-3.6.2"
for i in {1..10}; do stub uname '-s : echo Linux'; done stub uname '-s : echo Linux'
stub brew false stub brew false
stub_make_install stub_make_install
stub_make_install "$PYTHON_MAKE_INSTALL_TARGET" stub_make_install "$PYTHON_MAKE_INSTALL_TARGET"
@ -132,7 +132,7 @@ OUT
cached_tarball "yaml-0.1.6" cached_tarball "yaml-0.1.6"
cached_tarball "Python-3.6.2" cached_tarball "Python-3.6.2"
for i in {1..10}; do stub uname '-s : echo Linux'; done stub uname '-s : echo Linux'
stub brew false stub brew false
stub_make_install stub_make_install
stub_make_install stub_make_install
@ -162,7 +162,7 @@ OUT
cached_tarball "yaml-0.1.6" cached_tarball "yaml-0.1.6"
cached_tarball "Python-3.6.2" cached_tarball "Python-3.6.2"
for i in {1..10}; do stub uname '-s : echo Linux'; done stub uname '-s : echo Linux'
stub brew false stub brew false
stub_make_install stub_make_install
stub_make_install stub_make_install
@ -194,8 +194,8 @@ OUT
BREW_PREFIX="$TMP/homebrew-prefix" BREW_PREFIX="$TMP/homebrew-prefix"
mkdir -p "$BREW_PREFIX" mkdir -p "$BREW_PREFIX"
for i in {1..9}; do stub uname '-s : echo Darwin'; done stub uname '-s : echo Darwin'
for i in {1..2}; do stub sw_vers '-productVersion : echo 1010'; done stub sw_vers '-productVersion : echo 1010'
stub brew "--prefix : echo '$BREW_PREFIX'" false stub brew "--prefix : echo '$BREW_PREFIX'" false
stub_make_install stub_make_install
@ -222,8 +222,8 @@ OUT
brew_libdir="$TMP/homebrew-yaml" brew_libdir="$TMP/homebrew-yaml"
mkdir -p "$brew_libdir" mkdir -p "$brew_libdir"
for i in {1..10}; do stub uname '-s : echo Darwin'; done stub uname '-s : echo Darwin'
for i in {1..2}; do stub sw_vers '-productVersion : echo 1010'; done stub sw_vers '-productVersion : echo 1010'
stub brew "--prefix libyaml : echo '$brew_libdir'" stub brew "--prefix libyaml : echo '$brew_libdir'"
for i in {1..6}; do stub brew false; done for i in {1..6}; do stub brew false; done
stub_make_install stub_make_install
@ -249,8 +249,8 @@ OUT
readline_libdir="$TMP/homebrew-readline" readline_libdir="$TMP/homebrew-readline"
mkdir -p "$readline_libdir" mkdir -p "$readline_libdir"
for i in {1..8}; do stub uname '-s : echo Darwin'; done stub uname '-s : echo Darwin'
for i in {1..2}; do stub sw_vers '-productVersion : echo 1010'; done stub sw_vers '-productVersion : echo 1010'
for i in {1..3}; do stub brew false; done for i in {1..3}; do stub brew false; done
stub brew "--prefix readline : echo '$readline_libdir'" stub brew "--prefix readline : echo '$readline_libdir'"
for i in {1..2}; do stub brew false; done for i in {1..2}; do stub brew false; done
@ -279,8 +279,8 @@ OUT
ncurses_libdir="$TMP/homebrew-ncurses" ncurses_libdir="$TMP/homebrew-ncurses"
mkdir -p "$ncurses_libdir" mkdir -p "$ncurses_libdir"
for i in {1..9}; do stub uname '-s : echo Darwin'; done stub uname '-s : echo Darwin'
for i in {1..2}; do stub sw_vers '-productVersion : echo 1010'; done stub sw_vers '-productVersion : echo 1010'
for i in {1..4}; do stub brew false; done for i in {1..4}; do stub brew false; done
stub brew "--prefix ncurses : echo '$ncurses_libdir'" stub brew "--prefix ncurses : echo '$ncurses_libdir'"
stub brew false stub brew false
@ -307,9 +307,8 @@ OUT
@test "openssl is linked from Ports in FreeBSD if present" { @test "openssl is linked from Ports in FreeBSD if present" {
cached_tarball "Python-3.6.2" cached_tarball "Python-3.6.2"
for i in {1..7}; do stub uname '-s : echo FreeBSD'; done stub uname '-s : echo FreeBSD'
stub uname '-r : echo 11.0-RELEASE' stub uname '-r : echo 11.0-RELEASE'
for i in {1..3}; do stub uname '-s : echo FreeBSD'; done
stub sysctl '-n hw.ncpu : echo 1' stub sysctl '-n hw.ncpu : echo 1'
stub pkg "info -e openssl : true" stub pkg "info -e openssl : true"
@ -341,9 +340,8 @@ OUT
for lib in readline sqlite3; do for lib in readline sqlite3; do
for i in {1..7}; do stub uname '-s : echo FreeBSD'; done stub uname '-s : echo FreeBSD'
stub uname '-r : echo 11.0-RELEASE' stub uname '-r : echo 11.0-RELEASE'
for i in {1..3}; do stub uname '-s : echo FreeBSD'; done
stub sysctl '-n hw.ncpu : echo 1' stub sysctl '-n hw.ncpu : echo 1'
stub pkg false stub pkg false
@ -376,8 +374,8 @@ OUT
@test "homebrew is not touched if PYTHON_BUILD_SKIP_HOMEBREW is set" { @test "homebrew is not touched if PYTHON_BUILD_SKIP_HOMEBREW is set" {
cached_tarball "Python-3.6.2" cached_tarball "Python-3.6.2"
for i in {1..4}; do stub uname '-s : echo Darwin'; done stub uname '-s : echo Darwin'
for i in {1..2}; do stub sw_vers '-productVersion : echo 1010'; done stub sw_vers '-productVersion : echo 1010'
stub brew true; brew stub brew true; brew
stub_make_install stub_make_install
export PYTHON_BUILD_SKIP_HOMEBREW=1 export PYTHON_BUILD_SKIP_HOMEBREW=1
@ -405,7 +403,7 @@ OUT
BREW_PREFIX="$TMP/homebrew-prefix" BREW_PREFIX="$TMP/homebrew-prefix"
mkdir -p "$BREW_PREFIX" mkdir -p "$BREW_PREFIX"
for i in {1..4}; do stub uname '-s : echo Linux'; done stub uname '-s : echo Linux'
stub brew "--prefix : echo '$BREW_PREFIX'" stub brew "--prefix : echo '$BREW_PREFIX'"
for i in {1..5}; do stub brew false; done for i in {1..5}; do stub brew false; done
stub_make_install stub_make_install
@ -435,7 +433,7 @@ OUT
BREW_PREFIX="${BREW_PREFIX%/*}" BREW_PREFIX="${BREW_PREFIX%/*}"
BREW_PREFIX="${BREW_PREFIX%/*}" BREW_PREFIX="${BREW_PREFIX%/*}"
for i in {1..4}; do stub uname '-s : echo Linux'; done stub uname '-s : echo Linux'
stub brew "--prefix : echo '$BREW_PREFIX'" stub brew "--prefix : echo '$BREW_PREFIX'"
for i in {1..5}; do stub brew false; done for i in {1..5}; do stub brew false; done
stub_make_install stub_make_install
@ -464,7 +462,7 @@ OUT
BREW_PREFIX="$TMP/homebrew-prefix" BREW_PREFIX="$TMP/homebrew-prefix"
mkdir -p "$BREW_PREFIX" mkdir -p "$BREW_PREFIX"
for i in {1..9}; do stub uname '-s : echo Linux'; done stub uname '-s : echo Linux'
for i in {1..5}; do stub brew "--prefix : echo '$BREW_PREFIX'"; done for i in {1..5}; do stub brew "--prefix : echo '$BREW_PREFIX'"; done
stub_make_install stub_make_install
@ -493,8 +491,8 @@ OUT
mkdir -p "$readline_libdir/include/readline" mkdir -p "$readline_libdir/include/readline"
touch "$readline_libdir/include/readline/rlconf.h" touch "$readline_libdir/include/readline/rlconf.h"
for i in {1..8}; do stub uname '-s : echo Darwin'; done stub uname '-s : echo Darwin'
for i in {1..2}; do stub sw_vers '-productVersion : echo 1010'; done stub sw_vers '-productVersion : echo 1010'
for i in {1..5}; do stub brew false; done for i in {1..5}; do stub brew false; done
stub_make_install stub_make_install
@ -525,8 +523,8 @@ OUT
mkdir -p "$tcl_tk_libdir/lib" mkdir -p "$tcl_tk_libdir/lib"
echo "TCL_VERSION='$tcl_tk_version'" >>"$tcl_tk_libdir/lib/tclConfig.sh" echo "TCL_VERSION='$tcl_tk_version'" >>"$tcl_tk_libdir/lib/tclConfig.sh"
for i in {1..9}; do stub uname '-s : echo Darwin'; done stub uname '-s : echo Darwin'
for i in {1..2}; do stub sw_vers '-productVersion : echo 1010'; done stub sw_vers '-productVersion : echo 1010'
stub brew false stub brew false
stub brew "--prefix tcl-tk@8 : echo '$tcl_tk_libdir'" stub brew "--prefix tcl-tk@8 : echo '$tcl_tk_libdir'"
@ -559,8 +557,8 @@ OUT
tcl_tk_version_long="8.6.10" tcl_tk_version_long="8.6.10"
tcl_tk_version="${tcl_tk_version_long%.*}" tcl_tk_version="${tcl_tk_version_long%.*}"
for i in {1..8}; do stub uname '-s : echo Darwin'; done stub uname '-s : echo Darwin'
for i in {1..2}; do stub sw_vers '-productVersion : echo 1010'; done stub sw_vers '-productVersion : echo 1010'
for i in {1..4}; do stub brew false; done for i in {1..4}; do stub brew false; done
stub_make_install stub_make_install
@ -587,8 +585,8 @@ OUT
@test "tcl-tk is linked from Homebrew via pkgconfig only when envvar is set" { @test "tcl-tk is linked from Homebrew via pkgconfig only when envvar is set" {
cached_tarball "Python-3.6.2" cached_tarball "Python-3.6.2"
for i in {1..9}; do stub uname '-s : echo Darwin'; done stub uname '-s : echo Darwin'
for i in {1..2}; do stub sw_vers '-productVersion : echo 1010'; done stub sw_vers '-productVersion : echo 1010'
tcl_tk_libdir="$TMP/homebrew-tcl-tk" tcl_tk_libdir="$TMP/homebrew-tcl-tk"
mkdir -p "$tcl_tk_libdir/lib" mkdir -p "$tcl_tk_libdir/lib"
@ -620,8 +618,8 @@ OUT
@test "number of CPU cores defaults to 2" { @test "number of CPU cores defaults to 2" {
cached_tarball "Python-3.6.2" cached_tarball "Python-3.6.2"
for i in {1..10}; do stub uname '-s : echo Darwin'; done stub uname '-s : echo Darwin'
for i in {1..2}; do stub sw_vers '-productVersion : echo 10.10'; done stub sw_vers '-productVersion : echo 10.10'
stub sysctl false stub sysctl false
stub_make_install stub_make_install
@ -647,8 +645,8 @@ OUT
@test "number of CPU cores is detected on Mac" { @test "number of CPU cores is detected on Mac" {
cached_tarball "Python-3.6.2" cached_tarball "Python-3.6.2"
for i in {1..10}; do stub uname '-s : echo Darwin'; done stub uname '-s : echo Darwin'
for i in {1..2}; do stub sw_vers '-productVersion : echo 10.10'; done stub sw_vers '-productVersion : echo 10.10'
stub sysctl '-n hw.ncpu : echo 4' stub sysctl '-n hw.ncpu : echo 4'
stub_make_install stub_make_install
@ -675,9 +673,8 @@ OUT
@test "number of CPU cores is detected on FreeBSD" { @test "number of CPU cores is detected on FreeBSD" {
cached_tarball "Python-3.6.2" cached_tarball "Python-3.6.2"
for i in {1..7}; do stub uname '-s : echo FreeBSD'; done stub uname '-s : echo FreeBSD'
stub uname '-r : echo 11.0-RELEASE' stub uname '-r : echo 11.0-RELEASE'
for i in {1..3}; do stub uname '-s : echo FreeBSD'; done
for i in {1..3}; do stub pkg false; done for i in {1..3}; do stub pkg false; done
stub sysctl '-n hw.ncpu : echo 1' stub sysctl '-n hw.ncpu : echo 1'
@ -704,7 +701,7 @@ OUT
@test "setting PYTHON_MAKE_INSTALL_OPTS to a multi-word string" { @test "setting PYTHON_MAKE_INSTALL_OPTS to a multi-word string" {
cached_tarball "Python-3.6.2" cached_tarball "Python-3.6.2"
for i in {1..9}; do stub uname '-s : echo Linux'; done stub uname '-s : echo Linux'
stub_make_install stub_make_install
@ -728,7 +725,7 @@ OUT
@test "--enable-shared is not added if --disable-shared is passed" { @test "--enable-shared is not added if --disable-shared is passed" {
cached_tarball "Python-3.6.2" cached_tarball "Python-3.6.2"
for i in {1..9}; do stub uname '-s : echo Linux'; done stub uname '-s : echo Linux'
stub_make_install stub_make_install
@ -752,8 +749,8 @@ OUT
@test "configuring with dSYM in MacOS" { @test "configuring with dSYM in MacOS" {
cached_tarball "Python-3.6.2" cached_tarball "Python-3.6.2"
for i in {1..10}; do stub uname '-s : echo Darwin'; done stub uname '-s : echo Darwin'
for i in {1..2}; do stub sw_vers '-productVersion : echo 1010'; done stub sw_vers '-productVersion : echo 1010'
for i in {1..6}; do stub brew false; done for i in {1..6}; do stub brew false; done
stub_make_install stub_make_install
@ -779,7 +776,7 @@ OUT
@test "configuring with dSYM has no effect in non-MacOS" { @test "configuring with dSYM has no effect in non-MacOS" {
cached_tarball "Python-3.6.2" cached_tarball "Python-3.6.2"
for i in {1..10}; do stub uname '-s : echo Linux'; done stub uname '-s : echo Linux'
stub_make_install stub_make_install
run_inline_definition <<DEF run_inline_definition <<DEF
@ -811,10 +808,8 @@ OUT
@test "make on FreeBSD 9 defaults to gmake" { @test "make on FreeBSD 9 defaults to gmake" {
cached_tarball "Python-3.6.2" cached_tarball "Python-3.6.2"
stub uname "-s : echo FreeBSD" "-r : echo 9.1" stub uname "-s : echo FreeBSD"
for i in {1..6}; do stub uname "-s : echo FreeBSD"; done
stub uname "-r : echo 9.1" stub uname "-r : echo 9.1"
for i in {1..3}; do stub uname "-s : echo FreeBSD"; done
MAKE=gmake stub_make_install MAKE=gmake stub_make_install
@ -828,10 +823,8 @@ OUT
@test "make on FreeBSD 10" { @test "make on FreeBSD 10" {
cached_tarball "Python-3.6.2" cached_tarball "Python-3.6.2"
stub uname "-s : echo FreeBSD" "-r : echo 10.0-RELEASE" stub uname "-s : echo FreeBSD"
for i in {1..6}; do stub uname "-s : echo FreeBSD"; done
stub uname "-r : echo 10.0-RELEASE" stub uname "-r : echo 10.0-RELEASE"
for i in {1..3}; do stub uname "-s : echo FreeBSD"; done
stub_make_install stub_make_install
@ -844,10 +837,8 @@ OUT
@test "make on FreeBSD 11" { @test "make on FreeBSD 11" {
cached_tarball "Python-3.6.2" cached_tarball "Python-3.6.2"
stub uname "-s : echo FreeBSD" "-r : echo 11.0-RELEASE" stub uname "-s : echo FreeBSD"
for i in {1..6}; do stub uname "-s : echo FreeBSD"; done
stub uname "-r : echo 11.0-RELEASE" stub uname "-r : echo 11.0-RELEASE"
for i in {1..3}; do stub uname "-s : echo FreeBSD"; done
stub_make_install stub_make_install
@ -866,7 +857,7 @@ apply -p1 -i /my/patch.diff
exec ./configure "\$@" exec ./configure "\$@"
CONF CONF
for i in {1..9}; do stub uname '-s : echo Linux'; done stub uname '-s : echo Linux'
stub apply 'echo apply "$@" >> build.log' stub apply 'echo apply "$@" >> build.log'
stub_make_install stub_make_install

View File

@ -9,8 +9,8 @@ export -n PYTHON_CONFIGURE_OPTS
@test "require_gcc on OS X 10.9" { @test "require_gcc on OS X 10.9" {
for i in {1..3}; do stub uname '-s : echo Darwin'; done stub uname '-s : echo Darwin'
for i in {1..2}; do stub sw_vers '-productVersion : echo 10.9.5'; done stub sw_vers '-productVersion : echo 10.9.5'
stub gcc '--version : echo 4.2.1' stub gcc '--version : echo 4.2.1'
@ -31,8 +31,8 @@ OUT
} }
@test "require_gcc on OS X 10.10" { @test "require_gcc on OS X 10.10" {
for i in {1..3}; do stub uname '-s : echo Darwin'; done stub uname '-s : echo Darwin'
for i in {1..2}; do stub sw_vers '-productVersion : echo 10.10'; done stub sw_vers '-productVersion : echo 10.10'
stub gcc '--version : echo 4.2.1' stub gcc '--version : echo 4.2.1'
@ -69,8 +69,8 @@ DEF
mkdir -p "$INSTALL_ROOT" mkdir -p "$INSTALL_ROOT"
cd "$INSTALL_ROOT" cd "$INSTALL_ROOT"
for i in {1..10}; do stub uname '-s : echo Darwin'; done stub uname '-s : echo Darwin'
for i in {1..3}; do stub sw_vers '-productVersion : echo 10.10'; done stub sw_vers '-productVersion : echo 10.10'
stub cc 'false' stub cc 'false'
stub brew 'false' stub brew 'false'

View File

@ -144,7 +144,7 @@ OUT
echo "bar" | install_patch definitions/vanilla-python "Python-3.6.2/bar.patch" echo "bar" | install_patch definitions/vanilla-python "Python-3.6.2/bar.patch"
echo "baz" | install_patch definitions/vanilla-python "Python-3.6.2/baz.patch" echo "baz" | install_patch definitions/vanilla-python "Python-3.6.2/baz.patch"
for i in {1..2}; do stub uname '-s : echo Linux'; done stub uname '-s : echo Linux'
TMPDIR="$TMP" install_tmp_fixture definitions/vanilla-python < /dev/null TMPDIR="$TMP" install_tmp_fixture definitions/vanilla-python < /dev/null
assert_success assert_success
@ -171,7 +171,7 @@ OUT
" : echo \"$MAKE \$@\" >> build.log" \ " : echo \"$MAKE \$@\" >> build.log" \
" : echo \"$MAKE \$@\" >> build.log && cat build.log >> '$INSTALL_ROOT/build.log'" " : echo \"$MAKE \$@\" >> build.log && cat build.log >> '$INSTALL_ROOT/build.log'"
for i in {1..4}; do stub uname '-s : echo Darwin'; done stub uname '-s : echo Darwin'
PYTHON_MAKE_INSTALL_TARGET="altinstall" TMPDIR="$TMP" install_tmp_fixture definitions/vanilla-python < /dev/null PYTHON_MAKE_INSTALL_TARGET="altinstall" TMPDIR="$TMP" install_tmp_fixture definitions/vanilla-python < /dev/null
assert_success assert_success
@ -253,7 +253,8 @@ OUT
done done
unset framework_path executable unset framework_path executable
for i in {1..3}; do stub uname '-s : echo Darwin'; done stub uname '-s : echo Darwin'
stub sw_vers '-productVersion : echo 10.10'
PYTHON_CONFIGURE_OPTS="--enable-framework" TMPDIR="$TMP" run_inline_definition <<OUT PYTHON_CONFIGURE_OPTS="--enable-framework" TMPDIR="$TMP" run_inline_definition <<OUT
echo "PYTHON_CONFIGURE_OPTS_ARRAY=(\${PYTHON_CONFIGURE_OPTS_ARRAY[@]})" echo "PYTHON_CONFIGURE_OPTS_ARRAY=(\${PYTHON_CONFIGURE_OPTS_ARRAY[@]})"
@ -274,7 +275,8 @@ EOS
@test "enable universalsdk" { @test "enable universalsdk" {
for i in {1..3}; do stub uname '-s : echo Darwin'; done stub uname '-s : echo Darwin'
stub sw_vers '-productVersion : echo 10.10'
stub arch "echo x86_64" stub arch "echo x86_64"
PYTHON_CONFIGURE_OPTS="--enable-universalsdk" TMPDIR="$TMP" run_inline_definition <<OUT PYTHON_CONFIGURE_OPTS="--enable-universalsdk" TMPDIR="$TMP" run_inline_definition <<OUT
@ -292,7 +294,8 @@ EOS
@test "enable universalsdk on Apple Silicon" { @test "enable universalsdk on Apple Silicon" {
for i in {1..3}; do stub uname '-s : echo Darwin'; done stub uname '-s : echo Darwin'
stub sw_vers '-productVersion : echo 11.7'
stub arch "echo arm64" stub arch "echo arm64"
PYTHON_CONFIGURE_OPTS="--enable-universalsdk" TMPDIR="$TMP" run_inline_definition <<OUT PYTHON_CONFIGURE_OPTS="--enable-universalsdk" TMPDIR="$TMP" run_inline_definition <<OUT
@ -310,7 +313,8 @@ EOS
@test "enable universalsdk with explicit archs argument" { @test "enable universalsdk with explicit archs argument" {
for i in {1..3}; do stub uname '-s : echo Darwin'; done stub uname '-s : echo Darwin'
stub sw_vers '-productVersion : echo 11.7'
PYTHON_CONFIGURE_OPTS="--enable-universalsdk --with-universal-archs=foo" TMPDIR="$TMP" run_inline_definition <<OUT PYTHON_CONFIGURE_OPTS="--enable-universalsdk --with-universal-archs=foo" TMPDIR="$TMP" run_inline_definition <<OUT
echo "PYTHON_CONFIGURE_OPTS_ARRAY=(\${PYTHON_CONFIGURE_OPTS_ARRAY[@]})" echo "PYTHON_CONFIGURE_OPTS_ARRAY=(\${PYTHON_CONFIGURE_OPTS_ARRAY[@]})"
@ -325,7 +329,7 @@ EOS
cached_tarball "Python-3.6.2" cached_tarball "Python-3.6.2"
for i in {1..4}; do stub brew false; done for i in {1..4}; do stub brew false; done
for i in {1..8}; do stub uname '-s : echo Linux'; done stub uname '-s : echo Linux'
stub "$MAKE" \ stub "$MAKE" \
" : echo \"$MAKE \$@\" >> build.log" \ " : echo \"$MAKE \$@\" >> build.log" \
" : echo \"$MAKE \$@\" >> build.log && cat build.log >> '$INSTALL_ROOT/build.log'" " : echo \"$MAKE \$@\" >> build.log && cat build.log >> '$INSTALL_ROOT/build.log'"
@ -346,8 +350,8 @@ OUT
@test "default MACOSX_DEPLOYMENT_TARGET" { @test "default MACOSX_DEPLOYMENT_TARGET" {
# yyuu/pyenv#257 # yyuu/pyenv#257
for i in {1..3}; do stub uname '-s : echo Darwin'; done stub uname '-s : echo Darwin'
for i in {1..2}; do stub sw_vers '-productVersion : echo 10.10'; done stub sw_vers '-productVersion : echo 10.10'
TMPDIR="$TMP" run_inline_definition <<OUT TMPDIR="$TMP" run_inline_definition <<OUT
echo "\${MACOSX_DEPLOYMENT_TARGET}" echo "\${MACOSX_DEPLOYMENT_TARGET}"