cylc/cylc — pull request #343 by devkev (2013-03-11 11:03:49+00:00)
Title: Use os.path.realpath to resolve symlinks when finding cylc's location

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.