resources: remove unnecessary os.path.dirname import
[git-cola.git] / contrib / win32 / cola
blobcde2ef8c097693b83020485742e820fdf17ade0d
1 #!/bin/sh
2 # Windows doesn't have the 'dirname' command, so fake it
3 dirname() {
4 dir=$(echo "$@" | perl -pe 's,(.*)/[^/]+,\1,')
5 test "$dir" = "$1" && dir=.
6 echo "$dir"
9 mydir="$(dirname "$0")"
10 parentdir="$(dirname "$mydir")"
12 # Windows uses 'git-cola.pyw' instead of 'git-cola'
13 COLA="$parentdir"/bin/git-cola
14 if test -f "$COLA".pyw; then
15 COLA="$COLA".pyw
18 # The path to python can be specified by setting the
19 # PYTHON environment variable.
20 if test -z "$PYTHON"
21 then
22 PYTHON="$(which python.exe 2>/dev/null)"
24 # The path to python can be specified in the
25 # `cola.pythonlocation` git configuration variable.
26 if test -z "$PYTHON"
27 then
28 PYTHON="$(git config cola.pythonlocation)"
30 if test -n "$PYTHON"
31 then
32 exec "$PYTHON" "$COLA" "$@"
35 # Find a suitable Python and use it to run cola.
36 # If your python is installed in another location then
37 # add that path to the top of the list below or
38 # set the `cola.pythonlocation` git configuration variable.
39 for python in \
40 "/c/Python312" \
41 "/c/Python311" \
42 "/c/Python310" \
43 "/c/Python39" \
44 "/c/Python38" \
45 "/c/Python37" \
46 "/c/Python36" \
47 "/c/Python35" \
48 "/c/Python34"
50 if test -d "$python"
51 then
52 PATH="$python":"$PATH" exec "$python/python.exe" "$COLA" "$@"
54 done
55 exit 1