-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CI: simplify sqlite3.so fix for PyPy
Instead of forcing the use of OS provided libsqlite3.so through LD_PRELOAD, we now just delete PyPy's copy of the library. This is based on a suggestion by Armin Rigo in the following StackOverflow discussion: https://stackoverflow.com/questions/65476852/
- Loading branch information
Showing
3 changed files
with
22 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,26 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# Prepare environment to run Django with PyPy. | ||
|
||
# Unforunately needed for PyPy at the moment, because it comes with its own | ||
# libsqlite3.so.0, which doesn't have column metadata compiled in, which in turn | ||
# is needed by GDAL and Django. This forces the use of the libsqlite3 library | ||
# provided by the operationg system. This fixes running CATMAID's back-end test | ||
# suit with PyPy on both Travis CI and GH Actions, which failed before due to | ||
# the following error: | ||
# Prepare environment to run Django with PyPy. This effectively means removing | ||
# any copy of the shared library libsqlite3.so that comes with the existing PyPy | ||
# installations. | ||
# | ||
# This is unforunately needed for PyPy at the moment, because it comes with its | ||
# own libsqlite3.so.0 on both Travis and GitHub Actions, which doesn't have | ||
# column metadata compiled in, which in turn is needed by GDAL and Django. In | ||
# order to make PyPy use the OS provided libsqlite3.so, we delete PyPy's copy. | ||
# This fixes running CATMAID's back-end test suit with PyPy on both Travis CI | ||
# and GH Actions, which failed before due to the following error: | ||
# | ||
# OSError: Cannot load library libgdal.so.20: /usr/lib/libgdal.so.20: undefined symbol: sqlite3_column_table_name | ||
# | ||
# Since the OS level library is compiled with SQLITE_ENABLE_COLUMN_METADATA=1, | ||
# this is the library we want to use. | ||
if_pypy_force_os_sqlite_lib() { | ||
if python --version | grep PyPy ; then | ||
export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libsqlite3.so.0 | ||
echo "PyPy detected: override PyPy's own copy of libsqlite3.so with OS provided version" | ||
else | ||
echo "Not running PyPy, no library override needed" | ||
fi | ||
} | ||
# this is the library we want to use. More information can also be found here: | ||
# | ||
# https://stackoverflow.com/questions/65476852/ | ||
|
||
set -ex | ||
|
||
# Delete all files that have libsqlite3.so in their path name as well as PyPy | ||
# (regardless of the case of the P). | ||
echo 'Attempting to delete all PyPy copies of libsqlite3.so in order to use OS copy' | ||
sudo time find / -path /proc -prune -o -regex '.*[Pp]y[Pp]y.*libsqlite3\.so.*' -type f -exec rm -f {} + |