-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathinstall_pylucene.sh
More file actions
executable file
·49 lines (41 loc) · 1.66 KB
/
install_pylucene.sh
File metadata and controls
executable file
·49 lines (41 loc) · 1.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# --------------------------------------------
# Because pylucene is a pain to install,
# this script will try to install it for you.
# --------------------------------------------
# https://intoli.com/blog/exit-on-errors-in-bash-scripts/
set -e
# keep track of the last executed command
trap 'last_command=$current_command; current_command=$BASH_COMMAND' DEBUG
# echo an error message before exiting
trap 'echo "\"${last_command}\" command filed with exit code $?."' EXIT
# Change these variables as needed.
mirror=downloads
lucene_version=10.0.0
ant_version=1.10.14
# Download pylucene and ant.
curl -O https://${mirror}.apache.org/lucene/pylucene/pylucene-${lucene_version}-src.tar.gz
gunzip pylucene-${lucene_version}-src.tar.gz
tar -xvf pylucene-${lucene_version}-src.tar
mv pylucene-${lucene_version} pylucene
rm pylucene-${lucene_version}-src.tar
curl -O https://${mirror}.apache.org/ant/binaries/apache-ant-${ant_version}-bin.tar.gz
gunzip apache-ant-${ant_version}-bin.tar.gz
tar -xvf apache-ant-${ant_version}-bin.tar
rm apache-ant-${ant_version}-bin.tar
mv apache-ant-${ant_version} ant
export PATH="$PATH:$(pwd)/ant/bin"
# Install jcc.
# https://lucene.apache.org/pylucene/jcc/install.html
cd pylucene
pushd jcc
export JCC_INCLUDES=/opt/homebrew/Cellar/openjdk@21/21.0.10/libexec/openjdk.jdk/Contents/Home/include:/opt/homebrew/Cellar/openjdk@21/21.0.10/libexec/openjdk.jdk/Contents/Home/include/darwin
uv run setup.py build
uv run setup.py install
popd
# Install pylucene.
# https://lucene.apache.org/pylucene/install.html
ANT=$(which ant) PYTHON="uv run python" JCC="uv run python -m jcc --wheel" NUM_FILES=10 make
# Clean up the files.
cd ../
uv add pylucene/dist/*.whl
true