mirror of
https://github.com/wentasah/ros2nix.git
synced 2025-06-09 15:52:23 +03:00
Update test/ros2nix to set correct argv[0]
This commit is contained in:
parent
6b1e2ed106
commit
12a9d8de83
1 changed files with 18 additions and 4 deletions
22
test/ros2nix
22
test/ros2nix
|
@ -1,5 +1,19 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." &> /dev/null && pwd)
|
# Script for easy testing of ros2nix during development, i.e., without
|
||||||
export PYTHONPATH="$DIR:$PYTHONPATH"
|
# installation. You can add the directory of this script to PATH and
|
||||||
exec python3 -m ros2nix "$@"
|
# run ros2nix command.
|
||||||
|
|
||||||
|
import sys
|
||||||
|
import re
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
if __name__ == '__main__' and __package__ is None:
|
||||||
|
file = Path(__file__).resolve()
|
||||||
|
sys.path.append(str(file.parents[1]))
|
||||||
|
|
||||||
|
from ros2nix.ros2nix import main
|
||||||
|
|
||||||
|
sys.argv[0] = __file__
|
||||||
|
sys.argv[0] = re.sub(r"(-script\.pyw|\.exe)?$", "", sys.argv[0])
|
||||||
|
sys.exit(main())
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue