Skip to content

Commit

Permalink
Merge branch 'branch-24.04' of github.com:rapidsai/devcontainers into…
Browse files Browse the repository at this point in the history
… branch-24.06
  • Loading branch information
trxcllnt committed Mar 20, 2024
2 parents dfe5da8 + 39d3aec commit 63ddd47
Show file tree
Hide file tree
Showing 9 changed files with 64 additions and 38 deletions.
2 changes: 1 addition & 1 deletion features/src/rapids-build-utils/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "NVIDIA RAPIDS devcontainer build utilities",
"id": "rapids-build-utils",
"version": "24.6.3",
"version": "24.6.4",
"description": "A feature to install the RAPIDS devcontainer build utilities",
"containerEnv": {
"BASH_ENV": "/etc/bash.bash_env"
Expand Down
1 change: 1 addition & 0 deletions features/src/rapids-build-utils/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ declare -a commands=(
python-conda-pkg-names
python-pkg-names
python-pkg-roots
python-uses-scikit-build
python-uses-scikit-build-core
query-manifest
select-cmake-args
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,38 +36,42 @@ get_cmake_build_dir() {
# shellcheck disable=SC1091
. devcontainer-utils-debug-output 'rapids_build_utils_debug' 'get-cmake-build-dir';

if test "${REST[0]:-}" == --; then REST=("${REST[@]:1}"); fi;
if test "${REST[0]:-}" == --; then REST=("${REST[@]:1}"); fi

local bin="build";
local src="${REST[0]:-}";
local -r type="$(rapids-select-cmake-build-type "${OPTS[@]}" "${REST[@]:1}" | tr '[:upper:]' '[:lower:]')";
local -r cuda="$(grep -o '^[0-9]*.[0-9]*' <<< "${CUDA_VERSION:-${CUDA_VERSION_MAJOR:-12}.${CUDA_VERSION_MINOR:-0}}")";

bin+="${PYTHON_PACKAGE_MANAGER:+/${PYTHON_PACKAGE_MANAGER}}${cuda:+/cuda-${cuda}}";
if test -n "${src}" && rapids-python-uses-scikit-build "${src}"; then
echo "${src:+${src}/}$(python -c 'from skbuild import constants; print(constants.CMAKE_BUILD_DIR())')";
else
local -r type="$(rapids-select-cmake-build-type "${OPTS[@]}" "${REST[@]:1}" | tr '[:upper:]' '[:lower:]')";
local -r cuda="$(grep -o '^[0-9]*.[0-9]*' <<< "${CUDA_VERSION:-${CUDA_VERSION_MAJOR:-12}.${CUDA_VERSION_MINOR:-0}}")";
local bin="build";
bin+="${PYTHON_PACKAGE_MANAGER:+/${PYTHON_PACKAGE_MANAGER}}${cuda:+/cuda-${cuda}}";

if test -n "${src:-}" && test -d "${src:-}"; then
mkdir -p "${src}/${bin}";
if test -z "${skip_links-}"; then
if test -z "${skip_build_type-}" || ! test -L "${src}/${bin}/latest"; then
mkdir -p "${src}/${bin}/${type}";
cd "${src}/${bin}/" || exit 1;
ln -sfn "${type}" latest;
fi
cd "${src}/build" || exit 1;
local component;
for component in "${PYTHON_PACKAGE_MANAGER:-}" "${cuda:+cuda-${cuda}}"; do
if test -n "${component:-}"; then
ln -sfn "${component}/latest" latest;
cd "${component}" || exit 1;
if test -n "${src:-}" && test -d "${src:-}"; then
mkdir -p "${src}/${bin}";
if test -z "${skip_links-}"; then
if test -z "${skip_build_type-}" || ! test -L "${src}/${bin}/latest"; then
mkdir -p "${src}/${bin}/${type}";
cd "${src}/${bin}/" || exit 1;
ln -sfn "${type}" latest;
fi
done
cd "${src}/build" || exit 1;
local component;
for component in "${PYTHON_PACKAGE_MANAGER:-}" "${cuda:+cuda-${cuda}}"; do
if test -n "${component:-}"; then
ln -sfn "${component}/latest" latest;
cd "${component}" || exit 1;
fi
done
fi
fi
fi

if test -n "${skip_build_type-}"; then
echo "${src:+${src}/}${bin}/latest";
else
echo "${src:+${src}/}${bin}/${type}";
if test -n "${skip_build_type-}"; then
echo "${src:+${src}/}${bin}/latest";
else
echo "${src:+${src}/}${bin}/${type}";
fi
fi
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,15 @@ maybe_clean_build_dir() {

local -r bin_dir="$(rapids-get-cmake-build-dir "${OPTS[@]}" "${REST[@]}")";

case "${G:-Ninja}" in
"Unix Makefiles")
test -f "${bin_dir}/Makefile" || rm -rf "${bin_dir}";;
"Ninja")
test -f "${bin_dir}/build.ninja" || rm -rf "${bin_dir}";;
esac
if test -n "${bin_dir-}" && test -d "${bin_dir}"; then
case "${G:-Ninja}" in
"Unix Makefiles")
test -f "${bin_dir}/Makefile" || rm -rf "${bin_dir}";;
"Ninja")
test -f "${bin_dir}/build.ninja" || rm -rf "${bin_dir}";;
esac
fi

echo "${bin_dir}";
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ _list_repo_paths() {
for ((j=0; j < ${!py_length:-0}; j+=1)); do
local py_sub_dir="${repo}_python_${j}_sub_dir";
local py_path=~/"${!repo_path:-}${!py_sub_dir:+/${!py_sub_dir}}";
if rapids-python-uses-scikit-build-core "${py_path}"; then
if rapids-python-uses-scikit-build "${py_path}" \
|| rapids-python-uses-scikit-build-core "${py_path}"; then
echo "${py_path}";
fi
done
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
set -e;

test -f "${1}/pyproject.toml";
test "scikit_build_core.build" = "$(python -c "import toml; print(toml.load('${1}/pyproject.toml')['build-system']['build-backend'])" 2>/dev/null)";
test "scikit_build_core.build" = "$(/usr/local/python/current/bin/python -c "import toml; print(toml.load('${1}/pyproject.toml')['build-system']['build-backend'])" 2>/dev/null)";
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env bash

set -e;

test -f "${1}/pyproject.toml";
test "True" = "$(/usr/local/python/current/bin/python -c "import toml; print(any('scikit-build-core' not in x and 'scikit-build' in x for x in toml.load('${1}/pyproject.toml')['build-system']['requires']))" 2>/dev/null)";
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,12 @@ build_${PY_LIB}_python_wheel() {
$(rapids-select-pip-wheel-args "$@")
)";

if rapids-python-uses-scikit-build-core "${PY_SRC}"; then
if rapids-python-uses-scikit-build "${PY_SRC}"; then
# Clean the `_skbuild/.../cmake-build` dir if configuration failed before
if ! test -d "$(rapids-maybe-clean-build-dir "${cmake_args[@]}" -- "${PY_SRC}")"; then
rm -rf "${PY_SRC}/_skbuild";
fi
elif rapids-python-uses-scikit-build-core "${PY_SRC}"; then
pip_args+=(-C "build-dir=$(rapids-maybe-clean-build-dir "${cmake_args[@]}" -- "${PY_SRC}")");
fi

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,16 @@ install_${PY_LIB}_python() {
$(rapids-select-pip-install-args "$@")
)";

if rapids-python-uses-scikit-build-core "${PY_SRC}"; then
if rapids-python-uses-scikit-build "${PY_SRC}"; then
# Clean the `_skbuild/.../cmake-build` dir if configuration failed before
if ! test -d "$(rapids-maybe-clean-build-dir "${cmake_args[@]}" -- "${PY_SRC}")"; then
rm -rf "${PY_SRC}/_skbuild";
fi
if test ${#editable[@]} -gt 0; then
export SETUPTOOLS_ENABLE_FEATURES=legacy-editable;
fi
elif rapids-python-uses-scikit-build-core "${PY_SRC}"; then
pip_args+=(-C "build-dir=$(rapids-maybe-clean-build-dir "${cmake_args[@]}" -- "${PY_SRC}")");
elif test ${#editable[@]} -gt 0; then
export SETUPTOOLS_ENABLE_FEATURES=legacy-editable;
fi

# Put --editable at the end of pip_args
Expand Down

0 comments on commit 63ddd47

Please sign in to comment.