diff --git a/pyperf/pyperf_run b/pyperf/pyperf_run index 66d1475..b385fdb 100755 --- a/pyperf/pyperf_run +++ b/pyperf/pyperf_run @@ -2,7 +2,10 @@ PATH="${PATH}:/usr/local/bin" export PATH -python_pkg="python3.11" +python_pkgs="" +test_tools/detect_os | grep Ubuntu > /dev/null +ubuntu=$? +python_exec="" # # To make sure. # @@ -15,6 +18,8 @@ exit_out() usage() { echo "$1 Usage:" + echo "--python_exec_path: Python to set via alternatives" + echo "--python_pkgs: comma seprated list of python packages to install" source test_tools/general_setup --usage exit 1 } @@ -104,11 +109,18 @@ generate_csv_file() printf "%s:%12.2f:%s\n" $test_name $results $unit >> ${1}.csv } -dnf_install() +pkg_install() { - dnf install -y $1 - if [ $? -ne 0 ]; then - exit_out "dnf install of $1 failed" 1 + if [ $ubuntu -eq 0 ]; then + apt install -y $1 + if [ $? -ne 0 ]; then + exit_out "apt install of $1 failed" 1 + fi + else + dnf install -y $1 + if [ $? -ne 0 ]; then + exit_out "dnf install of $1 failed" 1 + fi fi } @@ -197,7 +209,8 @@ fi source test_tools/general_setup "$@" ARGUMENT_LIST=( - "python_pkg" + "python_exec" + "python_pkgs" ) NO_ARGUMENTS=( @@ -217,8 +230,12 @@ eval set --$opts while [[ $# -gt 0 ]]; do case "$1" in - --python_pkg) - python_pkg=$2 + --python_exec) + python_exec=$2 + shift 2 + ;; + --python_pkgs) + python_pkgs=$2 shift 2 ;; --usage) @@ -248,8 +265,23 @@ if [ $to_pbench -eq 0 ]; then if [ $? -ne 0 ]; then exit_out "Checkout of 1.0.4 failed." 1 fi - dnf_install "${python_pkg}" - dnf_install "${python_pkg}-devel" + if [[ ${python_pkgs} != "" ]]; then + pkg_list=`echo $python_pkgs | sed "s/,/ /g"` + echo pkg_list $pkg_list >>/tmp/dave + for i in $pkg_list; do + pkg_install $i + done + fi + if [[ $python_exec != "" ]]; then + if [[ ! -f $python_exec ]]; then + exit_out "Error: Designated python executable, $python_exec, not present" + fi + # + # Remove the existing (if any) default python. + # + alternatives --remove-all python + alternatives --install /usr/bin/python python $python_exec 1 + fi # # Install pip/pip3 #