~roadmr/ubuntu/precise/checkbox/0.13.1

« back to all changes in this revision

Viewing changes to plugins/lock_prompt.py

  • Committer: Bazaar Package Importer
  • Author(s): Marc Tardif, Gabor Keleman
  • Date: 2009-08-19 15:36:05 UTC
  • Revision ID: james.westby@ubuntu.com-20090819153605-weo6htup3yi6zn0t
Tags: 0.8~alpha4
* New upstream version:
  * Changed icon.
  * Added timeout property to lock_prompt plugin.
  * Added concept of attachments to tests.
  * Added support for backslahes in templates to wrap lines.
  * Added support blacklisting and whitelisting both tests and suites.
  * Introduced the concept of jobs for suites, tests and attachments.
  * Removed upstart event which is no longer needed.
  * Replaced architecture and category with requires in test definitions.
* Fixed pygst dependency (LP: #334442)
* Fixed configuration file updates during install (LP: #330596)
* Fixed and expanded translations (LP: #347038)
* Fixed ignored system proxy settings (LP: #345548)
* Fixed parsing blank lines in templates (LP: #393907)
* Fixed escaping of lists (LP: #394001)
* Fixed timeout in manual tests (LP: #377986)
* Fixed CLI interface dialog.
* Fixed support for FreeDesktop XDG base directory specification (LP: #363549)
* Added general and package specific apport hooks

[ Gabor Keleman ]
* Fixed untranslated strings in tests (LP: #374666)
* Fixed untranslated last screen (LP: #374646)

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
# You should have received a copy of the GNU General Public License
17
17
# along with Checkbox.  If not, see <http://www.gnu.org/licenses/>.
18
18
#
 
19
import os
19
20
import posixpath
20
21
 
 
22
from time import time
 
23
 
21
24
from gettext import gettext as _
22
25
 
23
26
from checkbox.contrib.glock import GlobalLock, LockAlreadyAcquired
24
27
 
25
28
from checkbox.lib.safe import safe_make_directory
26
29
 
27
 
from checkbox.properties import Path
 
30
from checkbox.properties import Int, Path
28
31
from checkbox.plugin import Plugin
29
32
 
30
33
 
33
36
    # Filename where the application lock is stored.
34
37
    filename = Path(default="%(checkbox_data)s/lock")
35
38
 
 
39
    # Timeout after which to show an error prompt.
 
40
    timeout = Int(default=0)
 
41
 
36
42
    def register(self, manager):
37
43
        super(LockPrompt, self).register(manager)
38
44
        self._lock = None
47
53
        try:
48
54
            self._lock.acquire()
49
55
        except LockAlreadyAcquired:
50
 
            self._manager.reactor.fire("prompt-error", interface,
51
 
                _("Another checkbox is running"),
52
 
                _("There is another checkbox running. Please close it first."))
 
56
            if time() - os.stat(self.filename).st_atime > self.timeout:
 
57
                self._manager.reactor.fire("prompt-error", interface,
 
58
                    _("There is another checkbox running. Please close it first."))
53
59
            self._manager.reactor.stop_all()
54
60
 
55
61