-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathprepare_extension.sh
executable file
·96 lines (81 loc) · 2.09 KB
/
prepare_extension.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#!/bin/bash
set -e
force_wheel_update=false
if [ -z "$PACKAGE_VERSION" ]; then
echo "PACKAGE_VERSION is required in the environment."
exit 1
fi
# Function to display script usage
usage() {
echo "Usage: $0 [OPTIONS]"
echo "Options:"
echo " -h, --help Display this help message"
echo " -f, --force Force update wheels directory even if it exists"
}
has_argument() {
[[ ("$1" == *=* && -n ${1#*=}) || (! -z "$2" && "$2" != -*) ]]
}
extract_argument() {
echo "${2:-${1#*=}}"
}
# Function to handle options and arguments
handle_options() {
while [ $# -gt 0 ]; do
case $1 in
-h | --help)
usage
exit 0
;;
-f | --force)
force_wheel_update=true
;;
*)
echo "Invalid option: $1" >&2
usage
exit 1
;;
esac
shift
done
}
update_wheel() {
rm -rf wheels
mkdir wheels
pip download -r ../../requirements.txt --dest ./wheels --only-binary=:all: --python-version=3.11
pip download -r ../../requirements.txt --dest ./wheels --only-binary=:all: --python-version=3.11 --platform=win_amd64 --exists-action=i
}
# Main script execution
handle_options "$@"
cd src/text2motion
should_update_wheel=true
if [ "$force_wheel_update" = false ]; then
if [ -d "wheels" ]; then
should_update_wheel=false
fi
fi
if [ "$should_update_wheel" = true ]; then
echo "Updating wheels..."
update_wheel
else
echo "Wheels directory already exists. Skipping wheel update."
fi
readarray -d '' wheel_files < <(find ./wheels/* -print0)
exclude_list=("urllib3")
result="["
for i in "${wheel_files[@]}"; do
skip=false
for exclude in "${exclude_list[@]}"; do
if [[ "$i" == *"$exclude"* ]]; then
skip=true
break
fi
done
if [ "$skip" = false ]; then
result+="\"$i\", "
fi
done
result+="]"
export PACKAGE_WHEELS=$result
cd ../..
echo "Generating src/text2motion/blender_manifest.toml..."
envsubst <blender_manifest.toml.template >src/text2motion/blender_manifest.toml