-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinit.sh
More file actions
executable file
·30 lines (25 loc) · 767 Bytes
/
Copy pathinit.sh
File metadata and controls
executable file
·30 lines (25 loc) · 767 Bytes
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
#!/bin/sh
#
# This file should be sourced before doing work in the compare-codecs
# environment.
#
# Function to remove duplicate path entries - to make running this file
# twice not grow the path. It also trims leading colons.
dedup() {
echo $1 | awk -F: '{for (i=1;i<=NF;i++) { if ( $i != "" && !x[$i]++ ) printf("%s:",$i); }}' | sed -e 's/:*$//'
}
if [ ! -f init.sh ]; then
echo "This init file must be sourced while in its own directory"
exit 1
fi
export WORKDIR=$PWD
PATH=$(dedup "$PATH:$WORKDIR/bin")
export PYTHONPATH=$(dedup "$PYTHONPATH:$WORKDIR/lib")
export CODEC_WORKDIR=$WORKDIR/workdir
export CODEC_TOOLPATH=$WORKDIR/tools
if [ ! -d $CODEC_WORKDIR ]; then
mkdir $CODEC_WORKDIR
fi
if [ ! -d $CODEC_TOOLPATH ]; then
mkdir $CODEC_TOOLPATH
fi