Browse Source

Merge JoinMarket-Org/joinmarket-clientserver#1425: Call `num_cores()` only after `deps_install()`

63d74bc0f1 Call num_cores() only after deps_install() (Kristaps Kaupe)

Pull request description:

  There may be no Python available before that.

  Alternative to #1419.

Top commit has no ACKs.

Tree-SHA512: 7a377fec8b819458e678ef2fd869bd6692f404772f4b42c4fd8caad530b0d49c96010841362b9279488781e914d917897589be46f562f8c5c5025a17f36542c4
master
Kristaps Kaupe 3 years ago
parent
commit
8d6e4f912b
No known key found for this signature in database
GPG Key ID: 33E472FE870C7E5D
  1. 24
      install.sh

24
install.sh

@ -2,13 +2,13 @@
cd "$(dirname "$0")" || exit
check_exists() {
check_exists()
{
command -v "$1" > /dev/null
}
num_cores() {
python -c 'import multiprocessing as mp; print(mp.cpu_count())'
}
# This may be overriden by --python/-p option.
python="python3"
# This is needed for systems where GNU is not the default make, like FreeBSD.
if check_exists gmake; then
@ -17,6 +17,11 @@ else
make="make"
fi
num_cores()
{
${python} -c 'import multiprocessing as mp; print(mp.cpu_count())'
}
sha256_verify ()
{
if [[ "$(uname)" == "Darwin" ]]; then
@ -574,7 +579,6 @@ install_get_os ()
main ()
{
# flags
python='python3'
build_local_tor=''
no_gpg_validation=''
use_os_deps_check='1'
@ -590,13 +594,12 @@ main ()
jm_source="$PWD"
if [ "$with_jmvenv" == 1 ]; then
jm_root="${jm_source}/jmvenv"
export PKG_CONFIG_PATH="${jm_root}/lib/pkgconfig:${PKG_CONFIG_PATH}"
export LD_LIBRARY_PATH="${jm_root}/lib:${LD_LIBRARY_PATH}"
export C_INCLUDE_PATH="${jm_root}/include:${C_INCLUDE_PATH}"
else
jm_root=""
fi
export PKG_CONFIG_PATH="${jm_root}/lib/pkgconfig:${PKG_CONFIG_PATH}"
export LD_LIBRARY_PATH="${jm_root}/lib:${LD_LIBRARY_PATH}"
export C_INCLUDE_PATH="${jm_root}/include:${C_INCLUDE_PATH}"
MAKEFLAGS="-j $(num_cores)" && export MAKEFLAGS
# os check
install_os="$( install_get_os )"
@ -605,6 +608,9 @@ main ()
echo "Dependecies could not be installed. Exiting."
return 1
fi
MAKEFLAGS="-j $(num_cores)" && export MAKEFLAGS
if [ "$with_jmvenv" == 1 ]; then
if ! venv_setup; then
echo "Joinmarket Python virtual environment could not be setup. Exiting."

Loading…
Cancel
Save