Skip to content

Commit 6bf7e62

Browse files
authored
Merge pull request #98 from dinkelk/event_decoder_update
Update socket_event_decoder_to_bin.sh so it can be run from anywhere
2 parents a6950af + dd67dde commit 6bf7e62

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

gnd/bin/socket_event_decoder_to_bin.sh

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
#!/bin/sh
1+
#!/bin/bash
22

3+
this_dir=`readlink -f "${BASH_SOURCE[0]}" | xargs dirname`
34
assembly_events_file=$1
45

56
if test -z "$assembly_events_file"
@@ -13,32 +14,32 @@ fi
1314
py_path=`which python`
1415
echo $py_path
1516
hidden_import=""
16-
for dir in `python socket_event_decoder.py --python-path 0.0.0.0 3001 108 $assembly_events_file output.log`
17+
for dir in `python $this_dir/socket_event_decoder.py --python-path 0.0.0.0 3001 108 $assembly_events_file output.log`
1718
do
1819
py_path=$py_path:$dir
1920
done
2021
echo "PYTHONPATH: $py_path"
2122
echo ""
2223

2324
# Get all modules that the program depends on:
24-
for module in `python socket_event_decoder.py --module-dependencies 0.0.0.0 3001 108 $assembly_events_file output.log`
25+
for module in `python $this_dir/socket_event_decoder.py --module-dependencies 0.0.0.0 3001 108 $assembly_events_file output.log`
2526
do
2627
hidden_import=$hidden_import" --hidden-import $module"
2728
done
2829
echo "hidden imports: $hidden_import"
2930
echo ""
3031

3132
# Run py installer.
32-
exe="pyinstaller --onefile -y socket_event_decoder.py -p $py_path -F --distpath build/bin --specpath build/bin $hidden_import"
33+
exe="pyinstaller --onefile -y $this_dir/socket_event_decoder.py -p $py_path -F --distpath $this_dir/build/bin --specpath $this_dir/build/bin $hidden_import"
3334
echo $exe
3435
$exe
3536
status=$?
3637

3738
if [ $status -eq 0 ]
3839
then
3940
# Copy assembly events file for production use.
40-
cp $assembly_events_file build/bin/assembly_events.py
41-
echo "\n -------- \n The build was successful. \n The socket_event_decoder executable is located at build/bin/socket_event_decoder. \n For more help you can run 'build/bin/socket_event_decoder -h' \n --------"
41+
cp $assembly_events_file $this_dir/build/bin/assembly_events.py
42+
echo "\n -------- \n The build was successful. \n The socket_event_decoder executable is located at $this_dir/build/bin/socket_event_decoder. \n For more help you can run '$this_dir/build/bin/socket_event_decoder -h' \n --------"
4243
exit 0
4344
else
4445
echo "\n -------- \n The build was unsuccessful, oh no! \n --------"

0 commit comments

Comments
 (0)