-
Notifications
You must be signed in to change notification settings - Fork 443
Expand file tree
/
Copy pathpython.sh
More file actions
executable file
·73 lines (61 loc) · 2.32 KB
/
python.sh
File metadata and controls
executable file
·73 lines (61 loc) · 2.32 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/bin/bash
# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set -e
error_exit()
{
echo "There was an error running python"
exit 1
}
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# MY_DIR="$(realpath -s "$SCRIPT_DIR")"
# Setup python env from generated file (generated by tools/repoman/build.py)
export CARB_APP_PATH=$SCRIPT_DIR/kit
export ISAAC_PATH=$SCRIPT_DIR
export EXP_PATH=$SCRIPT_DIR/apps
source ${SCRIPT_DIR}/setup_python_env.sh
# By default use our python, but allow overriding it by checking if PYTHONEXE env var is defined:
python_exe=${PYTHONEXE:-"${SCRIPT_DIR}/kit/python/bin/python3"}
# Parse command line arguments to check for --lldb-debug flag
use_lldb=false
filtered_args=()
for arg in "$@"; do
if [[ "$arg" == "--lldb-debug" ]]; then
use_lldb=true
else
filtered_args+=("$arg")
fi
done
if ! [[ -z "${CONDA_PREFIX}" ]]; then
echo "Warning: running in conda env, please deactivate before executing this script"
echo "If conda is desired please source setup_conda_env.sh in your python 3.11 conda env and run python normally"
fi
# Check if we are running in a docker container
if [ -f /.dockerenv ]; then
# Check for vulkan in docker container
if [[ -f "${SCRIPT_DIR}/vulkan_check.sh" ]]; then
${SCRIPT_DIR}/vulkan_check.sh
fi
fi
# Show icon if not running headless
export RESOURCE_NAME="IsaacSim"
# WAR for missing libcarb.so
export LD_PRELOAD="$SCRIPT_DIR/kit/libcarb.so${LD_PRELOAD:+:$LD_PRELOAD}"
# Run with lldb if --lldb-debug flag was specified, otherwise run normally
if [[ "$use_lldb" == true ]]; then
lldb -o run $python_exe -- "${filtered_args[@]}" $args || error_exit
else
$python_exe "${filtered_args[@]}" $args || error_exit
fi