Permalink
Browse files

win32: Add better documentation for Windows users

Generalize the `cola` shell script so that it can be used with
any python installation.  We allow users to configure the path
to `pythonw.exe` instead of the last-resort option of editing
the `cola` shell script.

Signed-off-by: David Aguilar <davvid@gmail.com>
  • Loading branch information...
1 parent 90969e8 commit 0d70c9984bf9e154def57b02db65b84ca0c00561 @davvid davvid committed Jun 8, 2012
Showing with 46 additions and 13 deletions.
  1. +6 −7 README.md
  2. +11 −0 win32/README.md
  3. +29 −6 win32/cola
View
@@ -101,13 +101,12 @@ Download the latest stable Git, Python 2.x, and Py2x-PyQt4 installers
* [git-cola Installer](https://github.com/git-cola/git-cola/downloads)
Once these are installed you can run *git-cola* from the Start menu or
-from a Git Bash by typing `cola`.
+by double-clicking on the `git-cola.pyw` script.
-If you are developing *git-cola* on Windows you can run the code by
-using the `win32/cola` shell script.
+You can also use `pythonw.exe` to invoke the `git-cola.pyw` script
+directly from the command-line.
- /c/Python26/python setup.py build
- win32/cola
+If you are developing *git-cola* on Windows you can run it from its
+source tree by using `pythonw.exe`.
-The `win32/cola` script assumes that you have `python` installed in
-either `/c/Python26` or `/c/Python25`. Adjust accordingly.
+ pythonw.exe bin/git-cola
View
@@ -0,0 +1,11 @@
+Windows Tips
+============
+* git-cola is tested on msysgit
+* Other git environments should work fine as long as `git`
+ can be found in the $PATH.
+* The provided `cola` shell script can be used to launch *git-cola*
+ if you do not want to keep `pythonw.exe` in your $PATH.
+* If your python is installed in a location other than `/c/Python*/`
+ then you can tell the `cola` script about it by setting the
+ `cola.pythonlocation` git configuration variable. e.g.:
+ $ git config --global cola.pythonlocation "/c/Program Files/Python27/pythonw.exe"
View
@@ -15,12 +15,35 @@ if test -f "$COLA".pyw; then
COLA="$COLA".pyw
fi
-# Find a suitable Python and use it to run cola
-for python in "/c/Python27" "/c/Python26" "/c/Python25"; do
- if test -d "$python"; then
- PATH="$PATH":"$python"
- export PATH
- exec "$python/python.exe" "$COLA" "$@"
+# The path to python can be specified by setting the
+# PYTHON environment variable.
+if test -z "$PYTHON"
+then
+ PYTHON="$(which pythonw.exe 2>/dev/null)"
+fi
+# The path to python can be specified in the
+# `cola.pythonlocation` git configuration variable.
+if test -z "$PYTHON"
+then
+ PYTHON="$(git config cola.pythonlocation)"
+fi
+if test -n "$PYTHON"
+then
+ exec "$PYTHON" "$COLA" "$@"
+fi
+
+# Find a suitable Python and use it to run cola.
+# If your python is installed in another location then
+# add that path to the top of the list below or
+# set the `cola.pythonlocation` git configuration variable.
+for python in \
+ "/c/Python27" \
+ "/c/Python26" \
+ "/c/Python25"
+do
+ if test -d "$python"
+ then
+ PATH="$python":"$PATH" exec "$python/pythonw.exe" "$COLA" "$@"
fi
done
exit 1

0 comments on commit 0d70c99

Please sign in to comment.