From 14f5227d37213e48c79ef5df0760f1be00a8fc13 Mon Sep 17 00:00:00 2001 From: a6802739 <songhao9021@gmail.com> Date: Mon, 18 Feb 2019 18:45:04 +0800 Subject: [PATCH] add python and os information in environment capture script --- tools/tf_env_collect.sh | 70 ++++++++++++++++++++++++++++++++--------- 1 file changed, 56 insertions(+), 14 deletions(-) diff --git a/tools/tf_env_collect.sh b/tools/tf_env_collect.sh index a1c9c88c58c..86f1fcd9de4 100755 --- a/tools/tf_env_collect.sh +++ b/tools/tf_env_collect.sh @@ -32,16 +32,62 @@ OUTPUT_FILE=tf_env.txt python_bin_path=$(which python || which python3 || die "Cannot find Python binary") { - echo - echo "== cat /etc/issue ===============================================" - uname -a - uname=`uname -s` - if [ "$(uname)" == "Darwin" ]; then - echo Mac OS X `sw_vers -productVersion` - elif [ "$(uname)" == "Linux" ]; then - cat /etc/*release | grep VERSION - fi - +echo +echo '== check python ===================================================' +} >> ${OUTPUT_FILE} + +cat <<EOF > /tmp/check_python.py +import platform + +print("""python version: %s +python branch: %s +python build version: %s +python compiler version: %s +python implementation: %s +""" % ( +platform.python_version(), +platform.python_branch(), +platform.python_build(), +platform.python_compiler(), +platform.python_implementation(), +)) +EOF +${python_bin_path} /tmp/check_python.py 2>&1 >> ${OUTPUT_FILE} + +{ +echo +echo '== check os platform ===============================================' +} >> ${OUTPUT_FILE} + +cat <<EOF > /tmp/check_os.py +import platform + +print("""os: %s +os kernel version: %s +os release version: %s +os platform: %s +linux distribution: %s +linux os distribution: %s +mac version: %s +uname: %s +architecture: %s +machine: %s +""" % ( +platform.system(), +platform.version(), +platform.release(), +platform.platform(), +platform.linux_distribution(), +platform.dist(), +platform.mac_ver(), +platform.uname(), +platform.architecture(), +platform.machine(), +)) +EOF +${python_bin_path} /tmp/check_os.py 2>&1 >> ${OUTPUT_FILE} + +{ echo echo '== are we in docker =============================================' num=`cat /proc/1/cgroup | grep docker | wc -l`; @@ -55,10 +101,6 @@ python_bin_path=$(which python || which python3 || die "Cannot find Python binar echo '== compiler =====================================================' c++ --version 2>&1 - echo - echo '== uname -a =====================================================' - uname -a - echo echo '== check pips ===================================================' pip list 2>&1 | grep "proto\|numpy\|tensorflow"