Use os.path.realpath to support symlinked programs.

Using os.path.abspath() with __file__ or sys.argv[0] is not sufficient
when cylc is invoked via a symlink in $PATH, or a symlinked directory
that is listed in $PATH.  This is because os.path.dirname() is used
(and "/../" appended) to go "up" to parent directories - but this is
the parent of the symlink's location, not the actual location of cylc.

The solution is to call os.path.realpath() after os.path.abspath(),
but before os.path.dirname(), to ensure that all symlinks are resolved
prior to ascending to the parent directory.

Fixes #342.
Merge branch 'master' into devkev-realpath

Conflicts:
	bin/cylc-dbviewer
(this command has been removed from cylc.)
Merge pull request #346 from hjoliver/devkev-realpath

Use os.path.realpath to resolve symlinks when finding cylc's location