Skip to content

Commit

Permalink
install: Use python3's venv module when available
Browse files Browse the repository at this point in the history
Python 3.3 and above provide a standard venv module which provides all
the functionality that install.sh needs from virtualenv.

As of this commit, JM itself requires Python 3.6+ anyway.
  • Loading branch information
dongcarl committed Nov 7, 2022
1 parent 8295f1e commit 8bbca60
Showing 1 changed file with 4 additions and 19 deletions.
23 changes: 4 additions & 19 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ deps_install ()
'python3-dev' \
'python3-pip' \
'python3-setuptools' \
'python3-venv' \
'libltdl-dev' )

if [ "$with_jmvenv" == 1 ]; then debian_deps+=("virtualenv"); fi
if [ "$with_sudo" == 1 ]; then debian_deps+=("sudo"); fi

darwin_deps=( \
Expand Down Expand Up @@ -152,21 +152,6 @@ dar_deps_install ()
if ! brew install ${dar_deps[@]}; then
return 1
fi

if ! which virtualenv >/dev/null; then
sudo_command=''
if [ "$with_sudo" == 1 ]; then
echo "
sudo password required to run :
\`sudo pip3 install virtualenv\`
"
sudo_command="sudo"
fi
if $with_jmvenv && ! $sudo_command pip3 install virtualenv; then
return 1
fi
fi
}

check_skip_build ()
Expand All @@ -193,7 +178,7 @@ venv_setup ()
else
reinstall='true'
fi
virtualenv -p "${python}" "${jm_source}/jmvenv" || return 1
"${python}" -m venv "${jm_source}/jmvenv" || return 1
source "${jm_source}/jmvenv/bin/activate" || return 1
pip install --upgrade pip
pip install --upgrade setuptools
Expand Down Expand Up @@ -623,7 +608,7 @@ main ()
fi
if [ "$with_jmvenv" == 1 ]; then
if ! venv_setup; then
echo "Joinmarket virtualenv could not be setup. Exiting."
echo "Joinmarket Python virtual environment could not be setup. Exiting."
return 1
fi
source "${jm_root}/bin/activate"
Expand Down Expand Up @@ -667,7 +652,7 @@ main ()
\`source jmvenv/bin/activate\`
from this directory, to activate virtualenv."
from this directory, to activate the virtual environment."
fi
}
main ${@}

0 comments on commit 8bbca60

Please sign in to comment.