From d045fb6662269671744d72f2e05b8ca612f845c3 Mon Sep 17 00:00:00 2001 From: Jordan Carlin Date: Mon, 22 Jul 2024 22:37:23 -0700 Subject: [PATCH] Update python versions --- bin/wally-package-install.sh | 45 ++++++++++++++++++--------------- bin/wally-tool-chain-install.sh | 9 ++----- 2 files changed, 26 insertions(+), 28 deletions(-) diff --git a/bin/wally-package-install.sh b/bin/wally-package-install.sh index 75b12a0ed..001de99ba 100755 --- a/bin/wally-package-install.sh +++ b/bin/wally-package-install.sh @@ -46,14 +46,15 @@ fi # Generate list of packages to install and package manager commands based on distro # Packages are grouped by which tool requires them. If multiple tools need a package, it is included in the first tool only if [ "$FAMILY" == rhel ]; then + PYTHON_VERSION=python3.12 PACKAGE_MANAGER="dnf" UPDATE_COMMAND="sudo $PACKAGE_MANAGER update -y" - GENERAL_PACKAGES=(which rsync git make cmake python3.12 python3-pip curl wget ftp tar pkgconf-pkg-config dialog mutt ssmtp) - GNU_PACKAGES=(autoconf automake libmpc-devel mpfr-devel gmp-devel gawk bison flex texinfo gperf libtool patchutils bc gcc gcc-c++ zlib-devel expat-devel libslirp-devel) - QEMU_PACKAGES=(glib2-devel libfdt-devel pixman-devel bzip2 ninja-build) - SPIKE_PACKAGES=(dtc boost-regex boost-system) - VERILATOR_PACKAGES=(help2man perl clang ccache gperftools numactl mold) - BUILDROOT_PACKAGES=(ncurses-base ncurses ncurses-libs ncurses-devel gcc-gfortran) + GENERAL_PACKAGES+=(which rsync git make cmake "$PYTHON_VERSION" "$PYTHON_VERSION"-pip curl wget ftp tar pkgconf-pkg-config dialog mutt ssmtp) + GNU_PACKAGES+=(autoconf automake libmpc-devel mpfr-devel gmp-devel gawk bison flex texinfo gperf libtool patchutils bc gcc gcc-c++ zlib-devel expat-devel libslirp-devel) + QEMU_PACKAGES+=(glib2-devel libfdt-devel pixman-devel bzip2 ninja-build) + SPIKE_PACKAGES+=(dtc boost-regex boost-system) + VERILATOR_PACKAGES+=(help2man perl clang ccache gperftools numactl mold) + BUILDROOT_PACKAGES+=(ncurses-base ncurses ncurses-libs ncurses-devel gcc-gfortran) # Extra packages not availale in rhel8, nice for Verilator and needed for sail respectively if (( RHEL_VERSION == 9 )); then VERILATOR_PACKAGES+=(perl-doc) @@ -62,23 +63,25 @@ if [ "$FAMILY" == rhel ]; then # A newer version of gcc is required for qemu OTHER_PACKAGES=(gcc-toolset-13) elif [ "$FAMILY" == ubuntu ]; then + if (( UBUNTU_VERSION >= 24 )); then + PYTHON_VERSION=python3.12 + VERILATOR_PACKAGES+=(mold) # Not availale in Ubuntu 20.04, nice for Verilator + elif (( UBUNTU_VERSION == 22 )); then + PYTHON_VERSION=python3.11 + VERILATOR_PACKAGES+=(mold) # Not availale in Ubuntu 20.04, nice for Verilator + elif (( UBUNTU_VERSION == 20 )); then + PYTHON_VERSION=python3.11 + OTHER_PACKAGES+=(gcc-10 g++-10 cpp-10) # Newer version of gcc needed for Verilator + fi PACKAGE_MANAGER="DEBIAN_FRONTEND=noninteractive apt-get" UPDATE_COMMAND="sudo $PACKAGE_MANAGER update -y && sudo $PACKAGE_MANAGER upgrade -y --with-new-pkgs" - GENERAL_PACKAGES=(rsync git make cmake python3 python3-pip python3-venv curl wget ftp tar pkg-config dialog mutt ssmtp) - GNU_PACKAGES=(autoconf automake autotools-dev curl libmpc-dev libmpfr-dev libgmp-dev gawk build-essential bison flex texinfo gperf libtool patchutils bc zlib1g-dev libexpat1-dev ninja-build libglib2.0-dev libslirp-dev) - QEMU_PACKAGES=(libfdt-dev libpixman-1-dev) - SPIKE_PACKAGES=(device-tree-compiler libboost-regex-dev libboost-system-dev) - VERILATOR_PACKAGES=(help2man perl g++ clang ccache libunwind-dev libgoogle-perftools-dev numactl perl-doc libfl2 libfl-dev zlib1g) - SAIL_PACKAGES=(opam z3) - BUILDROOT_PACKAGES=(ncurses-base ncurses-bin libncurses-dev gfortran) - # Extra packages not availale in Ubuntu 20.04, nice for Verilator - if (( UBUNTU_VERSION >= 22 )); then - VERILATOR_PACKAGES+=(mold) - fi - # Newer version of gcc needed for Ubuntu 20.04 for Verilator - if (( UBUNTU_VERSION == 20 )); then - OTHER_PACKAGES=(gcc-10 g++-10 cpp-10) - fi + GENERAL_PACKAGES+=(rsync git make cmake "$PYTHON_VERSION" python3-pip "$PYTHON_VERSION"-venv curl wget ftp tar pkg-config dialog mutt ssmtp) + GNU_PACKAGES+=(autoconf automake autotools-dev curl libmpc-dev libmpfr-dev libgmp-dev gawk build-essential bison flex texinfo gperf libtool patchutils bc zlib1g-dev libexpat1-dev ninja-build libglib2.0-dev libslirp-dev) + QEMU_PACKAGES+=(libfdt-dev libpixman-1-dev) + SPIKE_PACKAGES+=(device-tree-compiler libboost-regex-dev libboost-system-dev) + VERILATOR_PACKAGES+=(help2man perl g++ clang ccache libunwind-dev libgoogle-perftools-dev numactl perl-doc libfl2 libfl-dev zlib1g) + SAIL_PACKAGES+=(opam z3) + BUILDROOT_PACKAGES+=(ncurses-base ncurses-bin libncurses-dev gfortran) fi diff --git a/bin/wally-tool-chain-install.sh b/bin/wally-tool-chain-install.sh index 1bc7e1942..2511adfa0 100755 --- a/bin/wally-tool-chain-install.sh +++ b/bin/wally-tool-chain-install.sh @@ -59,7 +59,7 @@ git_check() { local url=$2 local check=$3 local branch="${4:-master}" - if [[ ((! -e $repo) && ($(git clone "$url") || true)) || ($(cd "$repo"; git fetch; git rev-parse HEAD) != $(cd $repo; git rev-parse origin/"$branch")) || (! -e $check) ]]; then + if [[ ((! -e $repo) && ($(git clone "$url") || true)) || ($(cd "$repo"; git fetch; git rev-parse HEAD) != $(cd "$repo"; git rev-parse origin/"$branch")) || (! -e $check) ]]; then return 0 else return 1 @@ -131,12 +131,7 @@ section_header "Setting up Python Environment" STATUS="python virtual environment" cd "$RISCV" if [ ! -e "$RISCV"/riscv-python/bin/activate ]; then - # If python3.12 is avaiable, use it. Otherise, use whatever version of python3 is installed. - if [ "$(which python3.12)" ]; then - python3.12 -m venv riscv-python - else - python3 -m venv riscv-python - fi + "$PYTHON_VERSION" -m venv riscv-python echo -e "${OK_COLOR}Python virtual environment created.\nInstalling pip packages.${ENDC}" else echo -e "${OK_COLOR}Python virtual environment already exists.\nUpdating pip packages.${ENDC}"