[mousetrap] Simplify configuration and update README.md



commit 5130b011f88c370e447c349e5bc5136914c678b4
Author: Stoney Jackson <dr stoney gmail com>
Date:   Fri Jun 19 11:59:32 2015 -0400

    Simplify configuration and update README.md
    
    - Guess prefix based on location of Python
    - Guess Python version
    - Revise README.md accordingly

 README.md    |   63 ++++++++++++++++++++++++++++++++-------------------------
 autogen.sh   |   12 +++++++++++
 configure.ac |    2 +
 3 files changed, 49 insertions(+), 28 deletions(-)
---
diff --git a/README.md b/README.md
index b36e8eb..a23cac8 100644
--- a/README.md
+++ b/README.md
@@ -29,49 +29,54 @@ to install the mousetrap dependencies for Fedora21, Python3 and OpenCV3.
 * Let Script run through until finished.
 
 
-## Download
-
-### Stable
+## Download, build, and install MouseTrap using autotools
 
     $ git clone git://git.gnome.org/mousetrap
+    $ cd mousetrap
+    $ ./autogen.sh
+    $ make
+    $ sudo make install
+
+By default Python 2.7 is used. To use Python 3, set $PYTHON to the
+path to the python3 executable. For example, assuming python3 is in your
+$PATH:
+
+    $ PYTHON="$(which python3)" ./autogen.sh
+
+Options passed to autogen.sh will be passed on to gnome-autogen.sh and
+ultimately configure. So, for example, you can override the guessed prefix by
+passing --prefix to autogen.sh:
 
-### Development
+    $ ./autogen.sh --prefix=/usr/local
 
-    $ git clone git://git.gnome.org/mousetrap --branch gnome3-wip
+Note: prefix is guessed based on the installed location of Python.
 
 
-## Installing
+## Download, build, and install MouseTrap using pip
+
+    $ git clone git://git.gnome.org/mousetrap
+    $ cd mousetrap
+    $ sudo pip install .
 
-### Using `pip`
 
-    cd mousetrap
-    sudo pip install .
+## Uninstal MouseTrap using autotools
 
-### Using `autotools`
+    $ sudo make uninstall
 
-    cd mousetrap
-    # For python3: 
-    PYTHON=$(which python3) ./autogen.sh # On Fedora, add --prefix=/usr
-    # For python2:
-    ./autogen.sh # On Fedora, add --prefix=/usr
-    make
-    sudo make install
 
-## Uninstalling
+## Running MouseTrap
 
-When uninstalling, make sure that you are in the Mousetrap folder that you used to install Mousetrap.
+    $ mousetrap
 
-### Using 'autotools'
 
-    sudo make uninstall
+## Stopping MouseTrap
 
-## Running
+From the terminal in which you started MouseTrap
 
-    mousetrap --help # Print the list of possible command-line options
-    mousetrap
+    ^C
 
 
-## Using
+## Using MouseTrap
 
 By default, MouseTrap tracks your face, allowing you to control the
 mouse pointer using a joystick metaphor. When you look left,
@@ -80,7 +85,7 @@ look down, it moves down; look straight ahead, it stops moving. To click,
 close your left eye for about 1.5 seconds.
 
 
-## Configuring
+## Configuring MouseTrap
 
 To customize MouseTrap's configuration, place a copy of the annotated built-in
 configuration in ~/.mousetrap.yaml, and then edit it.
@@ -102,12 +107,13 @@ Dump built-in annotated configuration.
 
     mousetrap --dump-annotated
 
-## Translating
+
+## Translating MouseTrap
 
 Use `src/mousetrap/locale/_language_/LC_MESSAGES/mousetrap.po` as your template (POT file).
 
 
-## Writing a Plugin
+## Writing a plugin for MouseTrap
 
 ### Example plugin class
 
@@ -167,6 +173,7 @@ classes:
 
 For more examples, see the plugins in `src/mousetrap/plugins`.
 
+
 ## Developing
 
 Makefile targets
diff --git a/autogen.sh b/autogen.sh
index de57b50..ec7ef33 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -1,6 +1,18 @@
 #!/bin/bash
 # Run this to generate all the initial makefiles, etc.
 
+
+## Guess the python version to use. Defaults to Python 2.7
+## To make python3 the default, move python3 to the front of
+## python_search_order.
+python_search_order="python python3"
+for python_version in $python_search_order ; do
+    if [ -z "$PYTHON" ] ; then
+        PYTHON="$(which $python_version)"
+    fi
+done
+export PYTHON
+
 srcdir=`dirname $0`
 test -z "$srcdir" && srcdir=.
 
diff --git a/configure.ac b/configure.ac
index adffbb6..0c04f73 100644
--- a/configure.ac
+++ b/configure.ac
@@ -18,6 +18,8 @@ AM_CHECK_PYMOD(gi.repository,,,[AC_MSG_ERROR(Could not find python module gi.rep
 AM_CHECK_PYMOD(Xlib,,,[AC_MSG_ERROR(Could not find python module Xlib)])
 AM_CHECK_PYMOD(yaml,,,[AC_MSG_ERROR(Could not find python module yaml)])
 
+AC_PREFIX_PROGRAM([python])
+
 AC_CONFIG_FILES([
 Makefile
 ])


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]