Use lockf() instead of flock() when locking repository/cache

This is a reworked version of Petros Moisiadis' original pull request
since some extra effort is needed to support access to read-only
repositories.
Improved error handling/reporting.

Closes #12.
Fix incorrect display of time

Closes #13
Fix timezone issue on python 3.2
Added missing repository path/url when raising DoesNotExist and AlreadyExists exceptions
Merge pull request #16 from Ernest0x/fix_repository_errors

Added missing repository path/url when raising DoesNotExist and AlreadyExists exceptions
Fix for sorting files in 'data' dir when non-integer filenames exist

On NFS it is possible that files named like '.nfsXXXXX' are created
when a file is removed while it is still opened by another process.
With this fix, all files under data/ that are not integers are
ignored so that int() works as expected.
Consider segment incomplete if segment file is empty or too small

This fixes an IOError that could be raised when trying to seek() to
a negative file offset, because (for any reason) a segment file was
empty (or too small).
Merge branch 'empty_segment_fix'