Skip to content

Commit

Permalink
Move install_ci_deps to seperate script
Browse files Browse the repository at this point in the history
  • Loading branch information
vespakoen committed Sep 8, 2023
1 parent 9addd8f commit f89b7c5
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 47 deletions.
44 changes: 44 additions & 0 deletions .github/scripts/ci_deps.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/usr/bin/env bash

command_exists() {
command -v "${1}" >/dev/null 2>&1;
}

is_root() {
[ "${EUID:-$(id -u)}" -eq 0 ];
}

install_ci_dependencies() {
if [ "${determined_os}" = "windows" ]; then
if command_exists choco; then
choco install curl --no-progress
fi
elif [ "${determined_os}" = "linux" ]; then
if command_exists apt; then
if ! is_root; then
maybe_sudo="sudo"
fi
${maybe_sudo} apt update
${maybe_sudo} apt install -y --no-install-recommends curl
elif command_exists yum; then
if ! is_root; then
maybe_sudo="sudo"
fi
${maybe_sudo} yum install curl
fi
elif [ "${determined_os}" = "macos" ]; then
prettyprint "Downloading libomp for: " "${OCL_MACOS_ARCHITECTURE}"
if [ "${OCL_MACOS_ARCHITECTURE}" = "arm64" ]; then
libomp_tar_loc=$(brew fetch --bottle-tag=arm64_big_sur libomp | grep -i downloaded | grep tar.gz | cut -f2 -d ":" | xargs echo)
else
libomp_tar_loc=$(brew fetch --bottle-tag=big_sur libomp | grep -i downloaded | grep tar.gz | cut -f2 -d ":" | xargs echo)
fi
temp_dir="/tmp"
cp "${libomp_tar_loc}" "${temp_dir}/libomp.tar.gz"
mkdir "${temp_dir}/libomp" || true
tar -xzf "${temp_dir}/libomp.tar.gz" -C "${temp_dir}/libomp"
libomp_prefix=$(find "${temp_dir}/libomp/libomp" -depth 1 | head -1)
export OPENMP_PREFIX_MACOS="${temp_dir}/libomp/libomp/fixed"
mv "${libomp_prefix}" "${OPENMP_PREFIX_MACOS}"
fi
}
44 changes: 0 additions & 44 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -186,45 +186,6 @@ command_exists() {
command -v "${1}" >/dev/null 2>&1;
}

is_root() {
[ "${EUID:-$(id -u)}" -eq 0 ];
}

install_ci_dependencies() {
if [ "${determined_os}" = "windows" ]; then
if command_exists choco; then
choco install curl --no-progress
fi
elif [ "${determined_os}" = "linux" ]; then
if command_exists apt; then
if ! is_root; then
maybe_sudo="sudo"
fi
${maybe_sudo} apt update
${maybe_sudo} apt install -y --no-install-recommends curl
elif command_exists yum; then
if ! is_root; then
maybe_sudo="sudo"
fi
${maybe_sudo} yum install curl
fi
elif [ "${determined_os}" = "macos" ]; then
prettyprint "Downloading libomp for: " "${OCL_MACOS_ARCHITECTURE}"
if [ "${OCL_MACOS_ARCHITECTURE}" = "arm64" ]; then
libomp_tar_loc=$(brew fetch --bottle-tag=arm64_big_sur libomp | grep -i downloaded | grep tar.gz | cut -f2 -d ":" | xargs echo)
else
libomp_tar_loc=$(brew fetch --bottle-tag=big_sur libomp | grep -i downloaded | grep tar.gz | cut -f2 -d ":" | xargs echo)
fi
temp_dir="/tmp"
cp "${libomp_tar_loc}" "${temp_dir}/libomp.tar.gz"
mkdir "${temp_dir}/libomp" || true
tar -xzf "${temp_dir}/libomp.tar.gz" -C "${temp_dir}/libomp"
libomp_prefix=$(find "${temp_dir}/libomp/libomp" -depth 1 | head -1)
export OPENMP_PREFIX_MACOS="${temp_dir}/libomp/libomp/fixed"
mv "${libomp_prefix}" "${OPENMP_PREFIX_MACOS}"
fi
}

download_boost() {
if [ ! -f "${TMPDIR:-"/tmp"}/boost.tar.gz" ]; then
prettyprint "Downloading boost.tar.gz"
Expand Down Expand Up @@ -534,11 +495,6 @@ if [ -n "${OCL_INSTALL_SYSTEM_DEPS}" ]; then
install_system_dependencies
fi

if [ -n "${OCL_INSTALL_CI_DEPS}" ]; then
prettyprint "Installing ci dependencies..."
install_ci_dependencies
fi

if [ -n "${OCL_INSTALL_BOOST}" ]; then
prettyprint "Installing Boost..."
install_boost
Expand Down
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,16 @@ skip = ["pp*", "*-musllinux*", "*-manylinux_i686"]

[tool.cibuildwheel.windows]
archs = ["AMD64", "x86", "ARM64"]
before-all = "cd {package} && bash ./install.sh --install-ci-deps"
before-all = "cd {package} && bash .github/scripts/ci_deps.sh"
before-build = "cd {package} && bash ./install.sh --install-boost --boost-with-python --python-executable python"

[tool.cibuildwheel.linux]
archs = ["x86_64", "aarch64"]
before-all = "cd {package} && bash ./install.sh --install-ci-deps"
before-all = "cd {package} && bash .github/scripts/ci_deps.sh"
before-build = "cd {package} && bash ./install.sh --install-boost --boost-with-python --python-executable python && cp --recursive --no-clobber boost_1_80_0 /host/home/runner/work/opencamlib/opencamlib"

[tool.cibuildwheel.macos]
archs = ["x86_64", "arm64"]
before-all = "cd {package} && bash ./install.sh --install-ci-deps"
before-all = "cd {package} && bash .github/scripts/ci_deps.sh"
before-build = "cd {package} && bash ./install.sh --install-boost --boost-with-python --python-executable python"
repair-wheel-command = "python src/pythonlib/delocate-wheel.py --require-archs {delocate_archs} -w {dest_dir} -v {wheel}"

0 comments on commit f89b7c5

Please sign in to comment.