#!/usr/bin/python
+
+
import os
import fcntl
import errno
import sys
import time
-from catalyst.support import CatalystError
+
+
+from catalyst.support import CatalystError, normpath
+
def writemsg(mystr):
sys.stderr.write(mystr)
if not self.islocked():
if lockdir[-1] == "/":
lockdir=lockdir[:-1]
- self.lockdir=normpath(lockdir)
+ self.lockdir = normpath(lockdir)
# if "DEBUG" in self.settings:
# print "setting lockdir to", self.lockdir
else:
def set_lockfile(self):
if not self.islocked():
- self.lockfile=normpath(self.lockdir+'/'+self.lockfilename)
+ self.lockfile = normpath(self.lockdir+'/'+self.lockfilename)
# if "DEBUG" in self.settings:
# print "setting lockfile to", self.lockfile
print i,time.time()
time.sleep(1)
print
- def normpath(mypath):
- newpath = os.path.normpath(mypath)
- if len(newpath) > 1:
- if newpath[1] == "/":
- newpath = "/"+newpath.lstrip("/")
- return newpath
+ #def normpath(mypath):
+ #newpath = os.path.normpath(mypath)
+ #if len(newpath) > 1:
+ #if newpath[1] == "/":
+ #newpath = "/"+newpath.lstrip("/")
+ #return newpath
print "Lock 5 starting"
Lock1=LockDir("/tmp/lock_path")
Lock1.unlock()
print "Lock1 unlock"
-#Lock1.write_lock()
-#time.sleep(2)
-#Lock1.unlock()
- ##Lock1.write_lock()
- #time.sleep(2)
- #Lock1.unlock()