mirror of
https://github.com/apisnetworks/pyenv.git
synced 2026-11-30 19:59:01 +00:00
python-build: print configure and make commands to the console (without envvars) (#3645)
This commit is contained in:
1 parent
8eb39f5070
commit
e374f5625f
3 files changed
+60
-5
No files matched your search
@@ -981,17 +981,23 @@ build_package_warn_unsupported() {
|
||||
|
||||
# Write a command to stdout (the build log) together with the build-related
|
||||
# environment variables that are set, so the line can be copy-pasted and rerun
|
||||
# by hand from the build directory. Then run the command.
|
||||
# by hand from the build directory. Unless in verbose mode (where the log is
|
||||
# already shown), also print the command without the variables to the console.
|
||||
# Then run the command.
|
||||
log_and_run() {
|
||||
local var line=""
|
||||
local var vars="" cmd
|
||||
for var in CC CFLAGS CPPFLAGS LDFLAGS LIBS PKG_CONFIG_PATH \
|
||||
MACOSX_DEPLOYMENT_TARGET KERNEL_BITS TCLTK_CFLAGS TCLTK_LIBS; do
|
||||
if [ -n "${!var}" ]; then
|
||||
line="${line}${var}=$(printf '%q' "${!var}") "
|
||||
vars="${vars}${var}=$(printf '%q' "${!var}") "
|
||||
fi
|
||||
done
|
||||
line="${line}$(printf '%q ' "$@")"
|
||||
echo "python-build: running: ${line% }"
|
||||
cmd="$(printf '%q ' "$@")"
|
||||
cmd="${cmd% }"
|
||||
echo "python-build: running: ${vars}${cmd}"
|
||||
if [ -z "$VERBOSE" ]; then
|
||||
echo "=> ${cmd}" >&3
|
||||
fi
|
||||
"$@"
|
||||
}
|
||||
|
||||
|
||||
@@ -198,6 +198,52 @@ OUT
|
||||
assert_success
|
||||
}
|
||||
|
||||
@test "configure and make commands are printed to the console without the build variables" {
|
||||
export TMPDIR="$BATS_TEST_TMPDIR"
|
||||
export YAML_CFLAGS="yaml_cflag1 yaml_cflag2"
|
||||
export CONFIGURE_OPTS="configure_opt1"
|
||||
|
||||
cached_tarball "yaml-0.1.6"
|
||||
cached_tarball "Python-3.6.2"
|
||||
|
||||
stub uname '-s : echo Linux'
|
||||
stub brew false
|
||||
stub_make_install
|
||||
stub_make_install
|
||||
|
||||
install_fixture definitions/needs-yaml
|
||||
assert_success
|
||||
assert_line "=> ./configure --prefix=$INSTALL_ROOT configure_opt1"
|
||||
assert_line "=> ./configure --prefix=$INSTALL_ROOT --enable-shared --libdir=$INSTALL_ROOT/lib configure_opt1"
|
||||
assert_line "=> make -j 2"
|
||||
assert_line "=> make install"
|
||||
refute grep -qF "CC=" <<<"$output"
|
||||
|
||||
unstub uname
|
||||
unstub make
|
||||
}
|
||||
|
||||
@test "configure and make commands are not printed to the console twice in verbose mode" {
|
||||
export TMPDIR="$BATS_TEST_TMPDIR"
|
||||
export CONFIGURE_OPTS="configure_opt1"
|
||||
|
||||
cached_tarball "yaml-0.1.6"
|
||||
cached_tarball "Python-3.6.2"
|
||||
|
||||
stub uname '-s : echo Linux'
|
||||
stub brew false
|
||||
stub_make_install
|
||||
stub_make_install
|
||||
|
||||
install_fixture -v definitions/needs-yaml
|
||||
assert_success
|
||||
refute_line "=> ./configure --prefix=$INSTALL_ROOT configure_opt1"
|
||||
refute_line "=> make -j 2"
|
||||
|
||||
unstub uname
|
||||
unstub make
|
||||
}
|
||||
|
||||
@test "apply python patch before building" {
|
||||
cached_tarball "yaml-0.1.6"
|
||||
cached_tarball "Python-3.6.2"
|
||||
|
||||
@@ -143,12 +143,15 @@ DEF
|
||||
local flags="CPPFLAGS=-I${BATS_TEST_TMPDIR}/install/include LDFLAGS=-L${BATS_TEST_TMPDIR}/install/lib\ -Wl\,-rpath\,${BATS_TEST_TMPDIR}/install/lib LIBS=-L${BATS_TEST_TMPDIR}/install/lib\ -Wl\,-rpath\,${BATS_TEST_TMPDIR}/install/lib MACOSX_DEPLOYMENT_TARGET=10.10"
|
||||
assert_output <<OUT
|
||||
python-build: running: CC=clang $flags ./configure --prefix=$INSTALL_ROOT --enable-shared --libdir=${BATS_TEST_TMPDIR}/install/lib
|
||||
=> ./configure --prefix=$INSTALL_ROOT --enable-shared --libdir=${BATS_TEST_TMPDIR}/install/lib
|
||||
./configure --prefix=$INSTALL_ROOT --enable-shared --libdir=${BATS_TEST_TMPDIR}/install/lib
|
||||
CC=clang
|
||||
CFLAGS=no
|
||||
python-build: running: $flags make -j 2
|
||||
=> make -j 2
|
||||
make -j 2
|
||||
python-build: running: $flags make install
|
||||
=> make install
|
||||
make install
|
||||
OUT
|
||||
|
||||
|
||||
Reference in new issue
Block a user