-lock_fname = path.join(
- path.dirname(path.dirname(path.dirname(__file__))),
- 'tmp', 'm_librarian.lock')
+if os.access('/var/run/lock', os.W_OK):
+ lock_dir = '/var/run/lock'
+else:
+ lock_dir = gettempdir()
+
+if hasattr(os, 'getuid'):
+ suffix = '-%d' % os.getuid()
+else:
+ suffix = ''
+
+lock_fname = os.path.join(lock_dir, 'm_librarian%s.lock' % suffix)