Skip to content

Commit

Permalink
Merge pull request #18 from redhat-performance/fix_ubuntu
Browse files Browse the repository at this point in the history
Fix ubuntu
  • Loading branch information
dvalinrh authored Sep 11, 2023
2 parents feb4045 + de1a7fe commit 442ed5d
Showing 1 changed file with 42 additions and 10 deletions.
52 changes: 42 additions & 10 deletions pyperf/pyperf_run
Original file line number Diff line number Diff line change
Expand Up @@ -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.
#
Expand All @@ -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
}
Expand Down Expand Up @@ -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
}

Expand Down Expand Up @@ -197,7 +209,8 @@ fi
source test_tools/general_setup "$@"

ARGUMENT_LIST=(
"python_pkg"
"python_exec"
"python_pkgs"
)

NO_ARGUMENTS=(
Expand All @@ -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)
Expand Down Expand Up @@ -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
#
Expand Down

0 comments on commit 442ed5d

Please sign in to comment.