Using Poetry to install all dependencies (#2221)

* Switch to Poetry for dependency management in setup

* Added curl dependency and removed python-pip and python3-pip

---------

Co-authored-by: B1N4RY-P4R45173 <kopakaajay123@gmail.com>
pull/2226/head
卂フ卂ㄚ Ҝㄖ卩卩卂Ҝ卂 2 years ago committed by GitHub
parent d38e57639f
commit 919d740415
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -221,11 +221,6 @@ if linux; then
fi fi
echo "Using virtualenv from path: ${PWNDBG_VENV_PATH}" echo "Using virtualenv from path: ${PWNDBG_VENV_PATH}"
# Install poetry if not already installed
if ! hash poetry 2> /dev/null; then
curl -sSL https://install.python-poetry.org | python3 -
fi
source "${PWNDBG_VENV_PATH}/bin/activate" source "${PWNDBG_VENV_PATH}/bin/activate"
~/.local/bin/poetry install --with dev ~/.local/bin/poetry install --with dev
fi fi

@ -20,7 +20,7 @@ osx() {
install_apt() { install_apt() {
sudo apt-get update || true sudo apt-get update || true
sudo apt-get install -y git gdb gdbserver python3-dev python3-venv python3-pip python3-setuptools libglib2.0-dev libc6-dbg sudo apt-get install -y git gdb gdbserver python3-dev python3-venv python3-setuptools libglib2.0-dev libc6-dbg curl
if uname -m | grep x86_64 > /dev/null; then if uname -m | grep x86_64 > /dev/null; then
sudo dpkg --add-architecture i386 || true sudo dpkg --add-architecture i386 || true
@ -31,25 +31,25 @@ install_apt() {
install_dnf() { install_dnf() {
sudo dnf update || true sudo dnf update || true
sudo dnf -y install gdb gdb-gdbserver python-devel python3-devel python-pip python3-pip glib2-devel make sudo dnf -y install gdb gdb-gdbserver python-devel python3-devel glib2-devel make curl
sudo dnf -y debuginfo-install glibc sudo dnf -y debuginfo-install glibc
} }
install_xbps() { install_xbps() {
sudo xbps-install -Su sudo xbps-install -Su
sudo xbps-install -Sy gdb gcc python-devel python3-devel python-pip python3-pip glibc-devel make sudo xbps-install -Sy gdb gcc python-devel python3-devel glibc-devel make curl
sudo xbps-install -Sy glibc-dbg sudo xbps-install -Sy glibc-dbg
} }
install_swupd() { install_swupd() {
sudo swupd update || true sudo swupd update || true
sudo swupd bundle-add gdb python3-basic make c-basic sudo swupd bundle-add gdb python3-basic make c-basic curl
} }
install_zypper() { install_zypper() {
sudo zypper mr -e repo-oss-debug || sudo zypper mr -e repo-debug sudo zypper mr -e repo-oss-debug || sudo zypper mr -e repo-debug
sudo zypper refresh || true sudo zypper refresh || true
sudo zypper install -y gdb gdbserver python-devel python3-devel python3-pip glib2-devel make glibc-debuginfo sudo zypper install -y gdb gdbserver python-devel python3-devel glib2-devel make glibc-debuginfo curl
sudo zypper install -y python2-pip || true # skip py2 installation if it doesn't exist sudo zypper install -y python2-pip || true # skip py2 installation if it doesn't exist
if uname -m | grep x86_64 > /dev/null; then if uname -m | grep x86_64 > /dev/null; then
@ -58,24 +58,24 @@ install_zypper() {
} }
install_emerge() { install_emerge() {
sudo emerge --oneshot --deep --newuse --changed-use --changed-deps dev-lang/python dev-python/pip dev-debug/gdb sudo emerge --oneshot --deep --newuse --changed-use --changed-deps dev-lang/python dev-debug/gdb
} }
install_pacman() { install_pacman() {
read -p "Do you want to do a full system update? (y/n) [n] " answer read -p "Do you want to do a full system update? (y/n) [n] " answer
# user want to perfom a full system upgrade # user want to perform a full system upgrade
answer=${answer:-n} # n is default answer=${answer:-n} # n is default
if [[ "$answer" == "y" ]]; then if [[ "$answer" == "y" ]]; then
sudo pacman -Syu || true sudo pacman -Syu || true
fi fi
sudo pacman -S --noconfirm --needed git gdb python python-pip python-capstone python-unicorn python-pycparser python-psutil python-ptrace python-pyelftools python-six python-pygments which debuginfod sudo pacman -S --noconfirm --needed git gdb python python-capstone python-unicorn python-pycparser python-psutil python-ptrace python-pyelftools python-six python-pygments which debuginfod curl
if ! grep -q "^set debuginfod enabled on" ~/.gdbinit; then if ! grep -q "^set debuginfod enabled on" ~/.gdbinit; then
echo "set debuginfod enabled on" >> ~/.gdbinit echo "set debuginfod enabled on" >> ~/.gdbinit
fi fi
} }
install_freebsd() { install_freebsd() {
sudo pkg install git gdb python py39-pip cmake gmake sudo pkg install git gdb python py39-pip cmake gmake curl
which rustc || sudo pkg install rust which rustc || sudo pkg install rust
} }
@ -179,20 +179,24 @@ if ! osx; then
PYTHON+="${PYVER}" PYTHON+="${PYVER}"
fi fi
# Create Python virtualenv # Install Poetry
if ! command -v poetry &> /dev/null; then
echo "Poetry not found. Installing Poetry..."
curl -sSL https://install.python-poetry.org | python3 -
export PATH="$HOME/.local/bin:$PATH"
else
echo "Poetry is already installed."
fi
# Create the Python virtual environment and install dependencies using poetry
if [[ -z "${PWNDBG_VENV_PATH}" ]]; then if [[ -z "${PWNDBG_VENV_PATH}" ]]; then
PWNDBG_VENV_PATH="./.venv" PWNDBG_VENV_PATH="./.venv"
fi fi
echo "Creating virtualenv in path: ${PWNDBG_VENV_PATH}" echo "Creating virtualenv in path: ${PWNDBG_VENV_PATH}"
${PYTHON} -m venv -- ${PWNDBG_VENV_PATH} ${PYTHON} -m venv -- ${PWNDBG_VENV_PATH}
PYTHON=${PWNDBG_VENV_PATH}/bin/python source ${PWNDBG_VENV_PATH}/bin/activate
poetry install
# Upgrade pip itself
${PYTHON} -m pip install --upgrade pip
# Create Python virtual environment and install dependencies in it
${PWNDBG_VENV_PATH}/bin/pip install -e .
if [ -z "$UPDATE_MODE" ]; then if [ -z "$UPDATE_MODE" ]; then
# Comment old configs out # Comment old configs out

Loading…
Cancel
Save