Skip to content

Commit

Permalink
Merge pull request #1033 from maresb/patch-1
Browse files Browse the repository at this point in the history
Make activation script more robust
  • Loading branch information
h-vetinari authored Apr 30, 2023
2 parents df1a8ac + 53e0768 commit 6d49c0b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 13 deletions.
33 changes: 21 additions & 12 deletions recipe/activate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,32 @@
# is benign and doesn't need to be deleted.

# where the GDB wrappers get installed
GDB_PREFIX=$CONDA_PREFIX/share/gdb/auto-load

# If the directory is not writable, nothing can be done
if [ ! -w $GDB_PREFIX ]; then
return
fi
GDB_PREFIX="$CONDA_PREFIX/share/gdb/auto-load"

# this needs to be in sync with the respective patch
PLACEHOLDER=replace_this_section_with_absolute_slashed_path_to_CONDA_PREFIX
PLACEHOLDER="replace_this_section_with_absolute_slashed_path_to_CONDA_PREFIX"
# the paths here are intentionally stacked, see #935, resp.
# https://github.com/apache/arrow/blob/master/docs/source/cpp/gdb.rst#manual-loading
WRAPPER_DIR=$GDB_PREFIX/$CONDA_PREFIX/lib
WRAPPER_DIR="$GDB_PREFIX/$CONDA_PREFIX/lib"

mkdir -p "$WRAPPER_DIR" || true
# If the directory is not writable, nothing can be done
if [ ! -w "$WRAPPER_DIR" ]; then
return
fi

mkdir -p $WRAPPER_DIR
# there's only one lib in that folder, but the libname changes
# based on the version so use a loop instead of hardcoding it.
for f in $GDB_PREFIX/$PLACEHOLDER/lib/*.py; do
# overwrite, because we don't have deactivation (i.e. symlink remains)
ln -sf $f $WRAPPER_DIR/$(basename $f)
for f in "$GDB_PREFIX/$PLACEHOLDER/lib/"*.py; do
if [ ! -e "$f" ]; then
# If the file doesn't exist, skip this iteration of the loop.
# (This happens when no files are found, in which case the
# loop runs with f equal to the pattern itself.)
continue
fi
target="$WRAPPER_DIR/$(basename "$f")"
# We have write permissions to WRAPPER_DIR but not necessarily target.
# Thus it's safest to delete the target in case it already exists.
rm -f "$target"
ln -s "$f" "$WRAPPER_DIR/$(basename "$f")"
done
2 changes: 1 addition & 1 deletion recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ source:
folder: testing

build:
number: 17
number: 18
# for cuda support, building with one version is enough to be compatible with
# all later versions, since arrow is only using libcuda, and not libcudart.
skip: true # [cuda_compiler_version not in ("None", cuda_compiler_version_min)]
Expand Down

0 comments on commit 6d49c0b

Please sign in to comment.