changeset 1540:191f3f08236d beta

fixes #258 RhodeCode 1.2 assumes egg folder is writable
author Marcin Kuzminski <marcin@python-works.com>
date Tue, 11 Oct 2011 01:08:23 +0200
parents bd604cf75c5a
children 70e646b2806a
files rhodecode/lib/celerylib/__init__.py rhodecode/lib/celerylib/tasks.py rhodecode/lib/indexers/__init__.py rhodecode/lib/pidlock.py rhodecode/lib/utils.py
diffstat 5 files changed, 10 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/rhodecode/lib/celerylib/__init__.py	Mon Oct 10 03:27:31 2011 +0200
+++ b/rhodecode/lib/celerylib/__init__.py	Tue Oct 11 01:08:23 2011 +0200
@@ -94,11 +94,11 @@
 def locked_task(func):
     def __wrapper(func, *fargs, **fkwargs):
         lockkey = __get_lockkey(func, *fargs, **fkwargs)
-        lockkey_path = dn(dn(dn(os.path.abspath(__file__))))
+        lockkey_path = config['here']
 
         log.info('running task with lockkey %s', lockkey)
         try:
-            l = DaemonLock(jn(lockkey_path, lockkey))
+            l = DaemonLock(file_=jn(lockkey_path, lockkey))
             ret = func(*fargs, **fkwargs)
             l.release()
             return ret
--- a/rhodecode/lib/celerylib/tasks.py	Mon Oct 10 03:27:31 2011 +0200
+++ b/rhodecode/lib/celerylib/tasks.py	Tue Oct 11 01:08:23 2011 +0200
@@ -97,10 +97,11 @@
 
     lockkey = __get_lockkey('get_commits_stats', repo_name, ts_min_y,
                             ts_max_y)
-    lockkey_path = dn(dn(dn(dn(os.path.abspath(__file__)))))
+    lockkey_path = config['here']
+
     log.info('running task with lockkey %s', lockkey)
     try:
-        lock = l = DaemonLock(jn(lockkey_path, lockkey))
+        lock = l = DaemonLock(file_=jn(lockkey_path, lockkey))
 
         #for js data compatibilty cleans the key for person from '
         akc = lambda k: person(k).replace('"', "")
--- a/rhodecode/lib/indexers/__init__.py	Mon Oct 10 03:27:31 2011 +0200
+++ b/rhodecode/lib/indexers/__init__.py	Tue Oct 11 01:08:23 2011 +0200
@@ -101,7 +101,7 @@
         from rhodecode.lib.pidlock import LockHeld, DaemonLock
         from rhodecode.lib.indexers.daemon import WhooshIndexingDaemon
         try:
-            l = DaemonLock(file=jn(dn(dn(index_location)), 'make_index.lock'))
+            l = DaemonLock(file_=jn(dn(dn(index_location)), 'make_index.lock'))
             WhooshIndexingDaemon(index_location=index_location,
                                  repo_location=repo_location,
                                  repo_list=repo_list)\
--- a/rhodecode/lib/pidlock.py	Mon Oct 10 03:27:31 2011 +0200
+++ b/rhodecode/lib/pidlock.py	Tue Oct 11 01:08:23 2011 +0200
@@ -29,17 +29,17 @@
     """daemon locking
     USAGE:
     try:
-        l = DaemonLock(desc='test lock')
+        l = DaemonLock(file_='/path/tolockfile',desc='test lock')
         main()
         l.release()
     except LockHeld:
         sys.exit(1)
     """
 
-    def __init__(self, file=None, callbackfn=None,
+    def __init__(self, file_=None, callbackfn=None,
                  desc='daemon lock', debug=False):
 
-        self.pidfile = file if file else os.path.join(
+        self.pidfile = file_ if file_ else os.path.join(
                                                     os.path.dirname(__file__),
                                                     'running.lock')
         self.callbackfn = callbackfn
--- a/rhodecode/lib/utils.py	Mon Oct 10 03:27:31 2011 +0200
+++ b/rhodecode/lib/utils.py	Tue Oct 11 01:08:23 2011 +0200
@@ -486,7 +486,7 @@
         os.makedirs(index_location)
 
     try:
-        l = DaemonLock(file=jn(dn(index_location), 'make_index.lock'))
+        l = DaemonLock(file_=jn(dn(index_location), 'make_index.lock'))
         WhooshIndexingDaemon(index_location=index_location,
                              repo_location=repo_location)\
             .run(full_index=full_index)