Debian Codegraph @

python/build.sh

raw
1 #!/bin/bash
2
3 # Invoke from anywhere to perform an incremental build of pycolmap bindings.
4 # Make sure to install the requirements from pyproject.toml. If colmap is not
5 # installed globally but in a custom directory, you should set the colmap_DIR
6 # environment variable, e.g.:
7 #
8 # colmap_DIR=/path/to/cmake/install/prefix pycolmap/incremental_build.sh
9
10 set -e
11
12 script_dir=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &> /dev/null && pwd)
13
14 pip install \
15 -ve \
16 "$script_dir/.."
17
18 # Symlink the compiled _core extension into the source tree so that the
19 # editable install (which adds python/ to sys.path) can find it.
20 site_pkg=$(python -c "import sysconfig; print(sysconfig.get_path('purelib'))")
21 core_so=$(ls -t "$site_pkg/pycolmap"/_core*.so 2>/dev/null | head -1)
22 if [ -n "$core_so" ]; then
23 ln -sf "$core_so" "$script_dir/pycolmap/"
24 fi