forked from openfheorg/openfhe-python
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build_package.sh
executable file
·51 lines (42 loc) · 1.47 KB
/
build_package.sh
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
50
51
#!/bin/bash
# Exit on any error
set -e
# Find the venv directory
if [ -d ".venv" ]; then
VENV_DIR=".venv"
elif [ -d "../.venv" ]; then
VENV_DIR="../.venv"
else
echo "The virtual environment does not exist. Please run 'python -m venv .venv' to create it." >&2
exit 1
fi
# Activate the virtual environment
source $VENV_DIR/bin/activate
# Install pybind11-stubgen
if ! pip show pybind11-stubgen > /dev/null; then
pip install pybind11-stubgen
fi
# Check if the virtual environment has the openfhe package installed
if ! pip show openfhe > /dev/null; then
echo "The openfhe package is not installed in the virtual environment. Please run 'pip install -e .' to install it." >&2
exit 1
fi
# Generate stub files using pybind11-stubgen
echo "Generating stub files..."
pybind11-stubgen openfhe
# Check if stub generation was successful
if [ $? -eq 0 ]; then
echo "Stub files generated successfully."
else
echo "Stub generation failed." >&2
exit 1
fi
# Move the generated stub files to the openfhe package directory
echo "Moving the generated stub files to the openfhe package directory..."
mv stubs/openfhe/* openfhe/
rm -r -d stubs
# Build the source distribution and wheel distribution
echo "Building the sdist and bdist_wheel..."
python setup.py sdist bdist_wheel
# Indicate where the distributions were saved
echo "The distributions have been built and are located in the 'dist' directory. You can install the package using 'pip install dist/<distribution_file>'."