add upt-tool wrapper for not needing to set PYTHONPATH in environment
Stefan Schuermans

Stefan Schuermans commited on 2020-07-31 17:40:35
Showing 3 changed files, with 19 additions and 2 deletions.

... ...
@@ -5,4 +5,3 @@ then
5 5
 fi
6 6
 export UPT_HOME="$(readlink -f "$(dirname "${BASH_SOURCE[0]}")")"
7 7
 export PATH="$UPT_HOME/bin${PATH:+:${PATH}}"
8
-export PYTHONPATH="$UPT_HOME/python3${PYTHONPATH:+:${PYTHONPATH}}"
... ...
@@ -1,10 +1,20 @@
1 1
 add_custom_command(
2 2
   OUTPUT
3
-  ${CMAKE_BINARY_DIR}/bin/upt-tool
3
+  ${CMAKE_BINARY_DIR}/lib/uproctrace/upt-tool.py
4 4
   DEPENDS
5 5
   ${CMAKE_CURRENT_SOURCE_DIR}/upt-tool.py
6 6
   COMMAND
7 7
   cp -a ${CMAKE_CURRENT_SOURCE_DIR}/upt-tool.py
8
+        ${CMAKE_BINARY_DIR}/lib/uproctrace/upt-tool.py
9
+)
10
+
11
+add_custom_command(
12
+  OUTPUT
13
+  ${CMAKE_BINARY_DIR}/bin/upt-tool
14
+  DEPENDS
15
+  ${CMAKE_CURRENT_SOURCE_DIR}/upt-tool.bash
16
+  COMMAND
17
+  cp -a ${CMAKE_CURRENT_SOURCE_DIR}/upt-tool.bash
8 18
         ${CMAKE_BINARY_DIR}/bin/upt-tool
9 19
 )
10 20
 
... ...
@@ -12,5 +22,6 @@ add_custom_target(
12 22
   upt-tool
13 23
   ALL
14 24
   DEPENDS
25
+  ${CMAKE_BINARY_DIR}/lib/uproctrace/upt-tool.py
15 26
   ${CMAKE_BINARY_DIR}/bin/upt-tool
16 27
 )
... ...
@@ -0,0 +1,7 @@
1
+#! /bin/bash
2
+
3
+UPT_HOME="$(readlink -f "$(dirname "$0")/..")"
4
+
5
+export PYTHONPATH="$UPT_HOME/python3${PYTHONPATH:+:${PYTHONPATH}}"
6
+
7
+exec "$UPT_HOME/lib/uproctrace/upt-tool.py" "$@"
0 8