forked from CVHub520/X-AnyLabeling
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build_executable.sh
56 lines (47 loc) · 1.61 KB
/
build_executable.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
#!/bin/bash
python_file="anylabeling/app_info.py"
variable_name="__preferred_device__"
variable_value=$(python3 - <<END
import re
with open("$python_file", "r") as f:
content = f.read()
target_variable = "__preferred_device__"
pattern = r'{} = "(.*?)"'.format(target_variable)
match = re.search(pattern, content)
if match:
print(match.group(1))
END
)
echo "$variable_name: $variable_value"
system=$1
if [ $system = "win-cpu" ]; then
expected_value="CPU"
if [ "$variable_value" = "$expected_value" ]; then
pyinstaller --noconfirm anylabeling-win-cpu.spec
else
echo "Variable $variable_name has a different value: $variable_value (expected: $expected_value)"
fi
elif [ $system = "win-gpu" ];then
expected_value="GPU"
if [ "$variable_value" = "$expected_value" ]; then
pyinstaller --noconfirm anylabeling-win-gpu.spec
else
echo "Variable $variable_name has a different value: $variable_value (expected: $expected_value)"
fi
elif [ $system = "linux-cpu" ];then
expected_value="CPU"
if [ "$variable_value" = "$expected_value" ]; then
pyinstaller --noconfirm anylabeling-linux-cpu.spec
else
echo "Variable $variable_name has a different value: $variable_value (expected: $expected_value)"
fi
elif [ $system = "linux-gpu" ];then
expected_value="GPU"
if [ "$variable_value" = "GPU" ]; then
pyinstaller --noconfirm anylabeling-linux-gpu.spec
else
echo "Variable $variable_name has a different value: $variable_value (expected: $expected_value)"
fi
else
echo "System value '$system' is not recognized."
fi