diff --git a/README.md b/README.md index 31ebc104a..2a3c38381 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/win32/README.md b/win32/README.md new file mode 100644 index 000000000..7c6188ed8 --- /dev/null +++ b/win32/README.md @@ -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" diff --git a/win32/cola b/win32/cola index 62a545799..4323b18cd 100755 --- a/win32/cola +++ b/win32/cola @@ -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