-
Notifications
You must be signed in to change notification settings - Fork 228
Expand file tree
/
Copy pathpython_topaz.in
More file actions
executable file
·40 lines (31 loc) · 1.14 KB
/
Copy pathpython_topaz.in
File metadata and controls
executable file
·40 lines (31 loc) · 1.14 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
#!/usr/bin/env bash
print_error() {
echo "
---------------------------------- PYTHON ERROR ---------------------------------
Has RELION been provided a Python interpreter with the correct environment?
The interpreter can be passed to RELION either during Cmake configuration by
using the Cmake flag -DPYTHON_EXE_PATH=<path/to/python/interpreter>.
---------------------------------------------------------------------------------
Using python executable: $1
"
}
# Set the Python executable path
python_executable="@PYTHON_EXE_PATH@"
# Check if the python executable exists
if [ ! -x "$python_executable" ]; then
# Check for default python executable
python_executable=$(command -v python)
if [ -z "$python_executable" ]; then
print_error "$python_executable"
exit 1
fi
fi
# Run the Python script with forwarded arguments
"$python_executable" -c "import re, sys; from topaz.main import main; sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]); sys.exit(main())" "$@"
# Check the return status of the python command
if [ $? -ne 0 ]; then
print_error "$python_executable"
exit 2
fi
# Exit
exit 0